instance method
attached?
Ruby on Rails edge
Since v5.2.8.1Signature
attached?()
Returns true if an attachment has been made.
“‘ class User < ApplicationRecord
has_one_attached :avatar
end
User.new.avatar.attached? # => false “‘
Source
# File activestorage/lib/active_storage/attached/one.rb, line 98
def attached?
attachment.present?
end
Defined in activestorage/lib/active_storage/attached/one.rb line 98
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attached::One