Module: Spira::Reflections

Included in:
Base
Defined in:
lib/spira/reflections.rb

Instance Method Summary collapse

Instance Method Details

#reflect_on_association(association) ⇒ Object


15
16
17
# File 'lib/spira/reflections.rb', line 15

def reflect_on_association(association)
  reflections[association].is_a?(AssociationReflection) ? reflections[association] : nil
end

#reflectionsObject

Returns a hash containing all AssociationReflection objects for the current class Example:

Invoice.reflections Account.reflections


11
12
13
# File 'lib/spira/reflections.rb', line 11

def reflections
  read_inheritable_attribute(:reflections) || write_inheritable_attribute(:reflections, {})
end