Sha256: 6a16626698ab16b9a33fc95d879d736c6c85711c14920ba2a1dcb9290da880ad
Contents?: true
Size: 406 Bytes
Versions: 31
Compression:
Stored size: 406 Bytes
Contents
class AddPriceToLineItem < ActiveRecord::Migration def up add_column :line_items, :price, :decimal, :null => false, :default => 0.0 change_table(:line_items) do |t| t.timestamps end Piggybak::LineItem.all.each do |line_item| line_item.update_attribute(:price, line_item.total/line_item.quantity) end end def down remove_column :line_items, :price end end
Version data entries
31 entries across 31 versions & 1 rubygems