Module: ActiveShrine::Reflection::ActiveRecordExtensions::ClassMethods

Defined in:
lib/active_shrine/reflection.rb

Instance Method Summary collapse

Instance Method Details

#reflect_on_all_attachmentsObject

Returns an array of reflection objects for all the attachments in the class.



60
61
62
# File 'lib/active_shrine/reflection.rb', line 60

def reflect_on_all_attachments
  shrine_attachment_reflections.values
end

#reflect_on_attachment(attachment) ⇒ Object

Returns the reflection object for the named attachment.

User.reflect_on_attachment(:avatar)
# => the avatar reflection


69
70
71
# File 'lib/active_shrine/reflection.rb', line 69

def reflect_on_attachment(attachment)
  shrine_attachment_reflections[attachment.to_s]
end

#shrine_attachment_reflectionsObject



54
55
56
# File 'lib/active_shrine/reflection.rb', line 54

def shrine_attachment_reflections
  @shrine_attachment_reflections ||= {}
end