Aneesha Bakharia
2006-May-30 11:39 UTC
[Rails] Help with Shopping Cart example from Agile Web Development 2nd Edition
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. -- Aneesha -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060530/55d418f6/attachment.html
Stephen Bartholomew
2006-May-30 11:46 UTC
[Rails] Help with Shopping Cart example from Agile Web Development 2nd Edition
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 Aneesha Bakharia wrote:> 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. > -- > Aneesha > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.7.4/351 - Release Date: 29/05/2006
Aneesha Bakharia
2006-May-30 11:59 UTC
[Rails] Help with Shopping Cart example from Agile Web Development 2nd Edition
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 5/30/06, Stephen Bartholomew <sb@2404.co.uk> wrote:> > 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 > > Aneesha Bakharia wrote: > > 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. > > -- > > Aneesha > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.394 / Virus Database: 268.7.4/351 - Release Date: > 29/05/2006 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Aneesha -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060530/63ea9ab9/attachment.html
Stephen Bartholomew
2006-May-30 12:05 UTC
[Rails] Help with Shopping Cart example from Agile Web Development 2nd Edition
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 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 > 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 5/30/06, *Stephen Bartholomew* <sb@2404.co.uk <mailto:sb@2404.co.uk>> > wrote: > > 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 > > Aneesha Bakharia wrote: > > 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. > > -- > > Aneesha > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > > http://lists.rubyonrails.org/mailman/listinfo/rails > <http://lists.rubyonrails.org/mailman/listinfo/rails> > > > > > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.1.394 / Virus Database: 268.7.4/351 - Release Date: > 29/05/2006 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org <mailto:Rails@lists.rubyonrails.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Aneesha > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.7.4/351 - Release Date: 29/05/2006
Peter Szinek
2006-May-30 12:27 UTC
[Rails] Help with Shopping Cart example from Agile Web Development 2nd Edition
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 andAre you sure you are rake-ing db:sessions:create and not db:session:create? I wrote a post about this on my blog[1], and it is my third most popular post so far - it seems lot of people are running into this... bw, Peter [1]http://www.rubyrailways.com/dbsessioncreate-problem-in-the-depot-app/