Skip to content

Instantly share code, notes, and snippets.

Created January 18, 2017 08:22
Show Gist options
  • Save anonymous/b886afe47e6c550edf027e42f295028f to your computer and use it in GitHub Desktop.
Save anonymous/b886afe47e6c550edf027e42f295028f to your computer and use it in GitHub Desktop.
class AddPriceToLineItem < ActiveRecord::Migration[5.0]
def change
add_column :line_items, :price, :decimal
LineItem.all.each do |li|
li.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