I have bought book Agile web development with Ruby on Rails and i have
come to the section: sessions.
I am having some problems figuring out what does each line of code do.
So i would be gratefull if somoeone would explain it to me.
First I have this:
session[:cart] ||= Cart.new
Ok i understand the second part which creates new if there isnt an
existing one. but the firt part is what i dont understand.
:cart is because of the name of the model cart.rb ?
Can i add more models ? Something like session[:cart, :person] ?
One more thing i dont understand is this line
in add_to_cart function.
I understand in general that it finds the id but where can i find more
documentation about params and how it is used ?
I have a link http://api.rubyonrails.org/ but it seems to me like it
isnt full ? I check for params cant find it, check for session
something small and unusuable…
Please help me ! I want to learn but im stuck