module ActiveRecord::Reflection::ClassMethods
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 named +association+ (use the symbol). Example:
def reflect_on_association(association) reflections[association].is_a?(AssociationReflection) ? reflections[association] : nil end