Created
September 1, 2011 08:44
-
-
Save lolmaus/1185735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddPriceToLineItems < ActiveRecord::Migration | |
def self.up | |
add_column :line_items, :price, :decimal | |
LineItem.all.each do |line_item| | |
line_item.price = line_item.product.price | |
line_item.save | |
end | |
end | |
def self.down | |
remove_column :line_items, :price | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment