Rails 3 session & cookie how to persist session id cookie -
i developing simple shopping cart based on session_id i.e. determination of user cart items used session_id.
but when user closes browser , opens again session id been changed. , loses items in cart.
i suspect such feature can provide saving session id in cookie.
am right?
any way question how provide functionality allows users cart items after closing browser?
i recommend reading rails guide: action controller overview (http://guides.rubyonrails.org/action_controller_overview.html).
sections 4 , 5 cover sessions , cookies , give deeper understanding on how use them , make easy tackle feature challenges.
i check out ruby on rails actiondispatch::cookies < object documentation (http://api.rubyonrails.org/classes/actiondispatch/cookies.html)
an example of controller code looking listed on resource. here example:
# sets cookie expires in 1 hour. cookies[:login] = { :value => "xj-122", :expires => 1.hour.from_now }
Comments
Post a Comment