Skip to content

Commit a08a43b

Browse files
Use method call syntax in delegated_type examples [ci-skip]
Using instance method notation (e.g. `Entry#entryable_class`) causes the syntax highlighter to treat "#entryable_class ..." as a code comment.
1 parent 990448f commit a08a43b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

activerecord/lib/active_record/delegated_type.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,16 @@ module DelegatedType
181181
# delegated_type :entryable, types: %w[ Message Comment ], dependent: :destroy
182182
# end
183183
#
184-
# Entry#entryable_class # => Message or Comment
185-
# Entry#entryable_name # => "message" or "comment"
186-
# Entry.messages # => Entry.where(entryable_type: "Message")
187-
# Entry#message? # => true when entryable_type == "Message"
188-
# Entry#message # => returns the message record, when entryable_type == "Message", otherwise nil
189-
# Entry#message_id # => returns entryable_id, when entryable_type == "Message", otherwise nil
190-
# Entry.comments # => Entry.where(entryable_type: "Comment")
191-
# Entry#comment? # => true when entryable_type == "Comment"
192-
# Entry#comment # => returns the comment record, when entryable_type == "Comment", otherwise nil
193-
# Entry#comment_id # => returns entryable_id, when entryable_type == "Comment", otherwise nil
184+
# @entry.entryable_class # => Message or Comment
185+
# @entry.entryable_name # => "message" or "comment"
186+
# Entry.messages # => Entry.where(entryable_type: "Message")
187+
# @entry.message? # => true when entryable_type == "Message"
188+
# @entry.message # => returns the message record, when entryable_type == "Message", otherwise nil
189+
# @entry.message_id # => returns entryable_id, when entryable_type == "Message", otherwise nil
190+
# Entry.comments # => Entry.where(entryable_type: "Comment")
191+
# @entry.comment? # => true when entryable_type == "Comment"
192+
# @entry.comment # => returns the comment record, when entryable_type == "Comment", otherwise nil
193+
# @entry.comment_id # => returns entryable_id, when entryable_type == "Comment", otherwise nil
194194
#
195195
# You can also declare namespaced types:
196196
#
@@ -199,8 +199,8 @@ module DelegatedType
199199
# end
200200
#
201201
# Entry.access_notice_messages
202-
# entry.access_notice_message
203-
# entry.access_notice_message?
202+
# @entry.access_notice_message
203+
# @entry.access_notice_message?
204204
#
205205
# === Options
206206
#
@@ -226,8 +226,8 @@ module DelegatedType
226226
# delegated_type :entryable, types: %w[ Message Comment ], primary_key: :uuid, foreign_key: :entryable_uuid
227227
# end
228228
#
229-
# Entry#message_uuid # => returns entryable_uuid, when entryable_type == "Message", otherwise nil
230-
# Entry#comment_uuid # => returns entryable_uuid, when entryable_type == "Comment", otherwise nil
229+
# @entry.message_uuid # => returns entryable_uuid, when entryable_type == "Message", otherwise nil
230+
# @entry.comment_uuid # => returns entryable_uuid, when entryable_type == "Comment", otherwise nil
231231
def delegated_type(role, types:, **options)
232232
belongs_to role, options.delete(:scope), **options, polymorphic: true
233233
define_delegated_type_methods role, types: types, options: options

0 commit comments

Comments
 (0)