Fix line item cache migration to work across orders in the staging servers.

This commit is contained in:
Andrew Spinks
2013-08-07 12:43:31 +10:00
parent c247c2d3ea
commit 7fbb5b13fb

View File

@@ -2,11 +2,17 @@ class UpdateLineItemCaching < ActiveRecord::Migration
class SpreeLineItem < ActiveRecord::Base
belongs_to :shipping_method, class_name: 'Spree::ShippingMethod'
belongs_to :variant, :class_name => "Spree::Variant"
def itemwise_shipping_cost
order = OpenStruct.new :line_items => [self]
shipping_method.compute_amount(order)
end
def amount
price * quantity
end
alias total amount
end