Your error message is:

wrong number of arguments (1 for 0)

That means that somewhere, you are calling a method that doesn't expect any
arguments and you are passing an argument to it.  The stack trace give you a
clue:

ArgumentError in StoreController#add_to_cart

app/models/cart.rb:13:in `initialize'
app/models/cart.rb:13:in `new'
app/models/cart.rb:13:in `add_product'
app/controllers/store_controller.rb:10:in `add_to_cart'
One of the methods listed (#add_to_cart, #initialize, #new, or #add_product)
is being called with an argument where it wasn't expecting one.

StoreController#add_to_cart
-- doesn't expect any methods, but this is called by the Rails framework as
an action, and Rails doesn't pass any arguments to the action methods
Cart#add_product
-- expects 1 argument, you're calling it with 1 argument in
StoreController#add_to_cart
CartItem#new
-- calls CartItem#initialize with however many arguments it was passed
-- is called with 1 argument in Cart#add_product
CartItem#initialze
-- expects 0 arguments, you passed 1 argument in via CartItem#new

--wpd

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to