module BigRecord::BrReflection::ClassMethods

Reflection allows you to interrogate Big Record classes and objects about their associations and aggregations. This information can, for example, be used in a form builder that took an Big Record object and created input fields for all of the attributes depending on their type and displayed the associations to other objects.

You can find the interface for the AggregateReflection and AssociationReflection classes in the abstract MacroReflection class.

Public Instance Methods

create_reflection_big_record(macro, name, options, big_record) click to toggle source
# File lib/big_record/br_reflection.rb, line 14
def create_reflection_big_record(macro, name, options, big_record)
  case macro
    when :has_many_big_records, :belongs_to_big_record, :belongs_to_many, :has_one_big_record, :has_and_belongs_to_many_big_records
      reflection = BrAssociationReflection.new(macro, name, options, big_record)
    when :composed_of_big_record
      reflection = BrAggregateReflection.new(macro, name, options, big_record)
  end
  write_inheritable_hash :reflections, name => reflection
  reflection
end