Class: Gemstonemerchant::Purchase
- Inherits:
-
Object
- Object
- Gemstonemerchant::Purchase
- 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 |