module ActiveFedora::Reflection::ClassMethods

def create_reflection(macro, name, options, active_fedora)

def create_reflection(macro, name, options, active_fedora)
  case macro
    when :has_many, :belongs_to, :has_and_belongs_to_many
      klass = AssociationReflection
      reflection = klass.new(macro, name, options, active_fedora)
  end
  self.reflections = self.reflections.merge(name => reflection)
  reflection
end

def reflect_on_association(association)


Invoice.reflect_on_association(:line_items).macro # returns :has_many
Account.reflect_on_association(:owner) # returns the owner AssociationReflection

Returns the AssociationReflection object for the +association+ (use the symbol).
def reflect_on_association(association)
  reflections[association].is_a?(AssociationReflection) ? reflections[association] : nil
end

def reflections


Account.reflections
Invoice.reflections

Example:
Returns a hash containing all AssociationReflection objects for the current class.
def reflections
  read_inheritable_attribute(:reflections) || write_inheritable_attribute(:reflections, {})
end