Re: Agile arguement error

Hi, yet another n00b working through the Agile book

Previously ted scharff wrote about a “ArgumentError in Store#add_to_cart
wrong number of arguments (0 for 1)”

I got the same argument, I think by not putting the (product) in the
add_product function in class Cart.

Now, probably through some similar typo, I’m getting a

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.+

#{RAILS_ROOT}/app/models/cart.rb:12:in add_product' #{RAILS_ROOT}/app/controllers/store_controller.rb:10:inadd_to_cart’

I probably just need to go to bed and look at this tomorrow, but if
someone can use their telepathy and see what I’m doing wrong I
wouldn’t mind hearing about it…
I’ve been comparing the source I mostly typed in by hand w/ what the
book shows, but don’t even know enough about Ruby/Rails at this point
to even do the equivalent of Java System.out.println() and see what’s
nil that shouldn’t be…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs