small medium large xlarge

10 Dec 2008, 17:22
Ron Nollen (2 posts)

Another question from a newbie… error messages are at the bottom of the post.

I’m running a linux installation of: ruby 1.8.6 Rails 2.2.2 Oracle

I was able to get through chapter 7 “Task B: Catalog Display” without any trouble, but I’ve hit a wall in chapter 8 “Task C: Cart Creation”. I have checked and rechecked my code, I even resorted to copying and pasting your code from without any luck.

I understand how the button “add to cart” is calling “add_to_cart” in the store controller… and find_cart is local, but add_product is in the Cart model… how does it know to find it there? And any idea what my problem might be?

Thanks for your help. Ron.

NoMethodError in StoreController#add_to_cart

undefined method `add_product’ for true:TrueClass

RAILS_ROOT: /home/nollenr/rubyonrails/depot

16 Dec 2008, 02:28
Sam Ruby (634 posts)

Apparently you are within the add_to_cart method, and are calling add_product on @cart. But instead of @cart being an instance of Cart, it is the value @true@. I would suggest looking into the find_car method to see if there is anything amiss in there.

You must be logged in to comment