Cart relationated with id

Hi, I want to make a cart that actually I initialize with my session. It
works right and one user has one cart but… If I want to make differents
carts for differents controllers?

I have the plugin acts_as_tree and I have a whos_controller that has
many products. These products can add to cart and in every
whos_controller in the show view I show the cart and I can add more
items to cart. I want to show a cart for whos/1, a different cart for
whos/2…

I don’t know if you understand me… It’s complicated for me explain it.

Actually I have initialized the cart like this:

def find_cart
@cart = (session[:cart] ||= Cart.new)
end

And I have a model cart.rb

My answer is very complicated? or is a simple initialization of cart?

thanks.

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