Merge pull request #50762 from p8/actiontext/document-associations-and-scopes
Document some ActionText methods [ci-skip]
This commit is contained in:
commit
3c3df4cea3
@ -39,7 +39,16 @@ class RichText < Record
|
||||
serialize :body, coder: ActionText::Content
|
||||
delegate :to_s, :nil?, to: :body
|
||||
|
||||
##
|
||||
# :method: record
|
||||
#
|
||||
# Returns the associated record.
|
||||
belongs_to :record, polymorphic: true, touch: true
|
||||
|
||||
##
|
||||
# :method: embeds
|
||||
#
|
||||
# Returns the <tt>ActiveStorage::Blob</tt>s of the embedded files.
|
||||
has_many_attached :embeds
|
||||
|
||||
before_save do
|
||||
|
@ -76,6 +76,7 @@ def with_all_rich_text
|
||||
includes(rich_text_association_names)
|
||||
end
|
||||
|
||||
# Returns the names of all rich text associations.
|
||||
def rich_text_association_names
|
||||
reflect_on_all_associations(:has_one).collect(&:name).select { |n| n.start_with?("rich_text_") }
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user