docbrown/app/models/discussion_lock.rb
Jeremy Friesen b0ba8bb9e5
Renaming method for clarity (#16791)
In looking at forem/forem#16787, it felt like we would benefit from a
similar approach as we adopted for nullifying blank strings.

This refactor helps pave the way for a "normalize_text_for" method (or
some such thing; naming things is hard).

This change also involved introducing a `describe` block into the
associated spec.
2022-03-07 12:55:56 -05:00

15 lines
609 B
Ruby

# @note When we destroy the related user, it's using dependent:
# :delete for the relationship. That means no before/after
# destroy callbacks will be called on this object.
#
# @note When we destroy the related article, it's using dependent:
# :delete for the relationship. That means no before/after
# destroy callbacks will be called on this object.
class DiscussionLock < ApplicationRecord
belongs_to :article
belongs_to :locking_user, class_name: "User"
include StringAttributeCleaner.nullify_blanks_for(:notes, :reason)
validates :article_id, uniqueness: true
end