I have a Users model which needs an :email
column (I forgot to add that column during the initial scaffold).
I opened the migration file and added
Sometimes rails generate migration add_email_to_users email:string
produces a migration like this
class AddEmailToUsers < ActiveRecord::Migration[5.0]
def change
end
end
In that case you have to manually an add_column to change
:
class AddEmailToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :email, :string
end
end
And then run rake db:migrate