Method: ActiveStorage::Attached::One#attached?
- Defined in:
- activestorage/lib/active_storage/attached/one.rb
#attached? ⇒ Boolean
Returns true if an attachment has been made.
class User < ApplicationRecord
has_one_attached :avatar
end
User.new.avatar.attached? # => false
73 74 75 |
# File 'activestorage/lib/active_storage/attached/one.rb', line 73 def attached? .present? end |