Adding a column to an existing table in a Rails migration

后端 未结 11 1806
借酒劲吻你
借酒劲吻你 2020-11-28 00:34

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

11条回答
  •  借酒劲吻你
    2020-11-28 00:49

    You can also do this .. rails g migration add_column_to_users email:string

    then rake db:migrate also add :email attribute in your user controller ;

    for more detail check out http://guides.rubyonrails.org/active_record_migrations.html

提交回复
热议问题