Forked from anonymous/20170118074621_add_price_to_line_item.rb
Last active
January 18, 2017 08:25
-
-
Save tbuehlmann/02327d8ca1f249175d5ced0d73ce288b 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 AddPriceToLineItem < ActiveRecord::Migration[5.0] | |
def change | |
add_column :line_items, :price, :decimal | |
LineItem.includes(:product).find_each do |li| | |
li.update(price: li.product.price) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment