Freddy Andersen wrote:
> def add_product(product)
> current_item = @items.find {|item| item.product == product}
> if current_item
> current_item.increment_quantity
> else
> @items << CartItem.new(product)
> end
> end
>
> Try changing this to
>
> def add_product(product)
> current_item = @items.find {|item| item.product == product}
> if current_item
> current_item.increment_quantity
> else
> item = CartItem.create(product)
> @items << item
> end
> end
This changed my error to:
undefined method `create' for CartItem:Class
Might be worth nothing that when I try to clear the session this is what
I get:
bio4054059:depot rmorourk$ rake db:sessions:clear
(in /Users/rmorourk/Sites/depot)
/Users/rmorourk/Sites/depot/config/boot.rb:26:Warning:
Gem::SourceIndex#search support for String patterns is deprecated
bio4054059:depot rmorourk$
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---