Module: Machinist::ActiveRecordHasManyExtensions

Included in:
ActiveRecord::Associations::HasManyAssociation
Defined in:
lib/machinist/active_record.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/machinist/active_record.rb', line 74

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

#plan(*args) ⇒ Object



83
84
85
86
# File 'lib/machinist/active_record.rb', line 83

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