Given: def empty_cart session[:cart] = nil flash[:notice] = “Your cart is currently empty” redirect_to :action => :index end
I am curious about :notice (and :cart). Where do these variables come from? Dealing with :cart first, in add_to_cart, we have: @cart = find_cart // which returns session[:cart] ||= Cart.new
So, reverting to my C/C++ I would imagine thinking of Cart.new returning and address of the Cart object (i.e. new Cart()). Then session[:cart] would be an index into a dictionary, but what is :cart? It hasn’t been assigned… I am confused here.
As for :notice, is that an invisible parameter? Global? Same questions on assignment.
Sorry for my ignorance of the language. Feel free to point me to a doc that explains this (i will continue looking on my own as well).