ClassMethods

Adds methods to the class related to creating and retrieving reflections.

Constants

Methods

#reflect_on_all_associations

Returns an array containing one reflection for each association declared in the model.

def reflect_on_all_associations(macro = nil)
  association_reflections = reflections.values
  macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections
end

#reflect_on_association

def reflect_on_association(association)
  reflections[association.to_sym]
end