Displaying 1 result from an estimated 1 matches for "initialize_cart".
2007 Oct 17
9
@session['user'] vs session[:user]
...en @session[''user''] and session[:user] ? and how
would you use each?
And another question, I have the following code:
def get_customer
if @session[''customer'']
@c = Customer.find(@session[''customer''])
end
end
private
def initialize_cart
if session[:cart_id]
@cart = Cart.find(session[:cart_id])
else
@cart = Cart.create
session[:cart_id] = @cart.id
end
end
How do I assign the cart to the logged in customer?
Thanks in advance,
Elle
--~--~---------~--~----~------------~-------~--~----~...