Class: Gemstonemerchant::Purchase

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::MultiParameterAttributes, Mongoid::Timestamps
Defined in:
app/models/gemstonemerchant/purchase.rb

Instance Method Summary collapse

Instance Method Details

#recalculate_price!Object



15
16
17
18
# File 'app/models/gemstonemerchant/purchase.rb', line 15

def recalculate_price!
  self.total_price = line_items.inject(0.0) { |sum, line_item| sum+= line_item.price }
  save!
end