instance method
attachment
Ruby on Rails 7.2.3
Since v5.2.8.1Signature
attachment()
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.
Source
# File activestorage/lib/active_storage/attached/one.rb, line 33
def attachment
change.present? ? change.attachment : record.public_send("#{name}_attachment")
end
Defined in activestorage/lib/active_storage/attached/one.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attached::One