Method: ActiveStorage::Attached::One#attachment

Defined in:
activestorage/lib/active_storage/attached/one.rb

#attachmentObject

Returns the associated attachment record.

You don’t have to call this method to access the attachment’s methods as they are all available at the model level.



33
34
35
# File 'activestorage/lib/active_storage/attached/one.rb', line 33

def attachment
  change.present? ? change.attachment : record.public_send("#{name}_attachment")
end