Reputation: 325
I have a site that calculates shipping costs, but I need the user to input zip code. I have considered GeoKit for my RoR site, but my question is - how do I store the zip code as a session variable?
Is a cookie the best way to do this? The user does not have to be logged in to enter zip code.
Thanks in advance!
Upvotes: 2
Views: 379
Reputation: 452
I would store it on the session itself, which typically is backed by a cookie. You can do it from the controller as simple as this:
session[:zip_code] = '12345'
See here for more information on the Rails session: http://rails.nuvvo.com/lesson/6372-action-controller-session
Upvotes: 2