Looks like you have two open posts for the same issue... Here is the
answer from the other post...

ahhhh Sorry I see now I was thinking that the CartItem class was an
activerecord class ... The issue is this:
Here you call a new object of CartItem with a product passed
@items << CartItem.new(product)
But here in the initialize you do not have a argument for
initialize...
class CartItem
  attr_reader :product, :quantity
  def initialize
    @product = product
    @quantity = 1
  end
Change it to this
class CartItem
  attr_reader :product, :quantity
  def initialize( product )
    @product = product
    @quantity = 1
  end

I would NEVER store the cartitem(add product to cart) in a session
object for a ecommerce application. Yes there are things that could/
should be stored in the session but not something like adding a
product to your cart... Unless you have a session replication system
for your back-end which then would store the session in either the
database or memcache anywho...

--~--~---------~--~----~------------~-------~--~----~
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