Class: MR::Factory::RecordFactory::Config

Inherits:
Object
  • Object
show all
Includes:
WithAssociationsConfig
Defined in:
lib/mr/factory/record_factory.rb

Instance Method Summary collapse

Instance Method Details

#ar_association_for(record, name) ⇒ Object



79
80
81
82
83
# File 'lib/mr/factory/record_factory.rb', line 79

def ar_association_for(record, name)
  if (reflection = record.class.reflect_on_association(name))
    record.association(reflection.name)
  end
end

#build_associated_record(association_name, record_class) ⇒ Object



75
76
77
# File 'lib/mr/factory/record_factory.rb', line 75

def build_associated_record(association_name, record_class)
  self.factory_for(association_name, record_class).record
end