Module: Manufactory::ActiveRecordHasManyExtensions

Included in:
ActiveRecord::Associations::HasManyAssociation
Defined in:
lib/manufactory/adapters/activerecord.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/manufactory/adapters/activerecord.rb', line 66

def make(*args, &block)
  lathe = Lathe.run(Manufactory::ActiveRecordAdapter, self.build, *args)
  unless Manufactory.nerfed?
    lathe.object.save!
    lathe.object.reload
  end
  lathe.object(&block)
end

#plan(*args) ⇒ Object



75
76
77
78
# File 'lib/manufactory/adapters/activerecord.rb', line 75

def plan(*args)
  lathe = Lathe.run(Manufactory::ActiveRecordAdapter, self.build, *args)
  Manufactory::ActiveRecordAdapter.assigned_attributes_without_associations(lathe)
end