I was successful in reaching page 184 in the book "Agile Web
Development with Rails" 3rd edition and while running the website with
PostGreSQL as the backend, the power went down. The PostGreSQL
database contents look OK and so do the source code files I was
editing. But whenever I click on any "Add To Cart" button in the
catalog, I get the following information in the terminal window where
the "script/server" command was issued. By the way, I'm using
Mongrel, not Webrick.
Processing StoreController#add_to_cart (for 127.0.0.1 at 2009-04-06
11:49:15) [POST]
Parameters: {"commit"=>"Add to Cart",
"authenticity_token"=>"2hiFEqPkmMUXAZnTJ6jN4TKkMagLt0BY0W/M6fJj1+w=",
"id"=>"1"}
Product Load (1.0ms) SELECT * FROM "products" WHERE
("products"."id" = 1)
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.add_product):
app/controllers/store_controller.rb:9:in `add_to_cart'
/usr/lib/ruby/1.8/mongrel.rb:159:in `process_client'
/usr/lib/ruby/1.8/mongrel.rb:158:in `each'
/usr/lib/ruby/1.8/mongrel.rb:158:in `process_client'
/usr/lib/ruby/1.8/mongrel.rb:285:in `run'
/usr/lib/ruby/1.8/mongrel.rb:285:in `initialize'
/usr/lib/ruby/1.8/mongrel.rb:285:in `new'
/usr/lib/ruby/1.8/mongrel.rb:285:in `run'
/usr/lib/ruby/1.8/mongrel.rb:268:in `initialize'
/usr/lib/ruby/1.8/mongrel.rb:268:in `new'
/usr/lib/ruby/1.8/mongrel.rb:268:in `run'
Rendered rescues/_trace (72.4ms)
Rendered rescues/_request_and_response (0.8ms)
Rendering rescues/layout (internal_server_error)
I really don't want to lose all my work, but I'm totally lost on how
to fix this problem.
Sincerely,
Arthur
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---