Skip to content

Commit 3c3df4c

Browse files
authored
Merge pull request rails#50762 from p8/actiontext/document-associations-and-scopes
Document some ActionText methods [ci-skip]
2 parents f4ef4a5 + 35ecdef commit 3c3df4c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

actiontext/app/models/action_text/rich_text.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ class RichText < Record
3939
serialize :body, coder: ActionText::Content
4040
delegate :to_s, :nil?, to: :body
4141

42+
##
43+
# :method: record
44+
#
45+
# Returns the associated record.
4246
belongs_to :record, polymorphic: true, touch: true
47+
48+
##
49+
# :method: embeds
50+
#
51+
# Returns the <tt>ActiveStorage::Blob</tt>s of the embedded files.
4352
has_many_attached :embeds
4453

4554
before_save do

actiontext/lib/action_text/attribute.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def with_all_rich_text
7676
includes(rich_text_association_names)
7777
end
7878

79+
# Returns the names of all rich text associations.
7980
def rich_text_association_names
8081
reflect_on_all_associations(:has_one).collect(&:name).select { |n| n.start_with?("rich_text_") }
8182
end

0 commit comments

Comments
 (0)