instance method
attached?
Ruby on Rails 7.0.10
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 72
def attached?
attachment.present?
end
Defined in activestorage/lib/active_storage/attached/one.rb line 72
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attached::One