Fixed bug order.profit calculation.

Order.profit will also be saved, when order is closed.
This commit is contained in:
Benjamin Meichsner 2009-03-17 19:43:41 +01:00
parent 843e4a7233
commit da08365816
32 changed files with 408 additions and 34 deletions

View file

@ -0,0 +1,13 @@
class AddProfitToOrders < ActiveRecord::Migration
def self.up
add_column :orders, :foodcoop_result, :decimal, :precision => 8, :scale => 2
Order.closed.each do |order|
order.update_attribute(:foodcoop_result, order.profit)
end
end
def self.down
remove_column :orders, :foodcoop_result
end
end