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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -