When creating a model in Rails, I forgot to add a column amount that I want. How can I add it to the model later?
Create a new migration via the console with:
rails g migration add_amount_to_items
This should create a migration something like this:
class AddAmountToItems < ActiveRecord::Migration
  def change
    # add_column table_name, :column_name, :column_type
    add_column :items, :amount, :integer
  end
end
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With