Storing data in sessions with mysql2 database
I developed a ruby on rails 3 web app, and i had originally depended on a sqlite3 database that was locally stored in my computer before deploying it. I stored certain information in the sessions to get certain part of my web app to work.
However after deploying, i decided to use a mysql2 database from xeround.com and my website broke down. At first I had gotten an error message saying that i did not have a sessions table in the database. So I created a sessions table. And now it says
ActiveRecord::StatementInvalid in ClientController#index
Mysql2::Error: Unknown column 'sessions.session_id' in 'where clause': SELECT `sessions`.* FROM `sessions` WHERE `sessions`.`session_id` = '................开发者_StackOverflow中文版' LIMIT 1
Would i have to create the appropriate columns manually in the new sessions table that I made in the mysql2 database? Or is there another way to get around it?
What seems to be missing is session_id
do check in your table sessions
does it have column named session_id in it? if it is not there then create it through a migration. According to me, you should not do anything manually cause, in future if you wants to make some changes or rollback the tables you might face some issues.
精彩评论