Money-Rails provides reversible migration helpers to add monetized columns to your database. You can use add_monetize to add a money field or remove_monetize if writing separate up and down methods. These helpers can be customized in a MoneyRails.configure block.
When using add_monetize, you can specify options for the currency column, such as currency: { present: false } if you do not want a separate currency column.
class MonetizeProduct < ActiveRecord::Migration
def change
add_monetize :products, :price
# OR
change_table :products do |t|
t.monetize :price
end
end
end
# Example without a currency column
class MonetizeItem < ActiveRecord::Migration
def change
add_monetize :items, :price, currency: { present: false }
end
end