Hi I get to about page 103 of the book and get an application error. Further investigation reveals the following error in the dev log: Mysql::Error: #42S22Unknown column 'id' in 'where clause': UPDATE sessions SET `data` = 'BAh7BzoJY2FydG86CUNhcnQGOgtAaXRlbXNbBm86DUNhcnRJdGVtBzoOQHF1\nYW50aXR5aQY6DUBwcm9kdWN0bzoMUHJvZHVjdAY6EEBhdHRyaWJ1dGVzewsi\nDmltYWdlX3VybCIWL2ltYWdlcy9yYWlscy5wbmciCnRpdGxlIgdzZCIKcHJp\nY2UiCjIyLjk1IhNkYXRlX2F2YWlsYWJsZSIYMjAwNi0wMS0wNiAxNjoxNzow\nMCIHaWQiBjEiEGRlc2NyaXB0aW9uIghzZGYiCmZsYXNoSUM6J0FjdGlvbkNv\nbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA=\n', `session_id` = '8766ece0645091e5e6769c2abf77c5c7', `updated_at` = '2006-05-30 21:29:38' WHERE id = NULL If I delete the session entry from the database, the product listing is displayed, but if I reload the page I get the error again. Any help will be very much appreciated.
on 2006-05-30 15:42
on 2006-05-30 15:48
Hmm.. the error says that the 'id' column can't be found - that should have been created when the sessions table was set up. Have you checked the 'sessions' table in the database to see if it has an 'id' column? Steve
on 2006-05-30 16:00
I had trouble running the rake task eg rake db:sessions:create. The task runs but the table does not get created. So I just went and created the database with the three columns from the migration that was generated eg t.column :session_id, :string t.column :data, :text t.column :updated_at, :datetime I've added an id field and the shopping cart is working. Any idea why the rake task did not create the table. Thanks for you help. Aneesha
on 2006-05-30 16:06
Did you get any errors when you run the rake task? I'm not sure why it wouldn't work... Just as a note, the 'id' doesn't appear in the migrations because it's a given convention - you wont have to specify it when creating tables using migrations. Steve
on 2006-05-30 16:28
Aneesha Bakharia wrote: > I had trouble running the rake task eg rake db:sessions:create. > The task runs but the table does not get created. So I just went and Are you sure you are rake-ing db:sessions:create and not db:session:create? I wrote a post about this on my blog, and it is my third most popular post so far - it seems lot of people are running into this... bw, Peter http://www.rubyrailways.com/dbsessioncreate-proble...