Ruby on Rails: adding columns to existing database

前端 未结 7 711
Happy的楠姐
Happy的楠姐 2021-01-30 07:49

I\'m getting an error:

SQLite3::SQLException: no such column: ideas.list_id: 
SELECT \"ideas\".* FROM \"ideas\"  
WHERE \"ideas\".\"list_id\" = 2
7条回答
  •  生来不讨喜
    2021-01-30 07:57

    You can also do this ..

    rails g migration add_column_to_users list_id:string

    then rake db:migrate

    also add :list_id attribute in your user controller ;

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

提交回复
热议问题