Anyone know if I can put a hash in the cookie? Something like this: cookies [: test] = {: top => 5,: middle => 3,: bottom => 1}
Thanks
There are a number of ways which it is possible (i.e. storing a string and eval
ing that value, SCARY!). This is a simple way.
cookies[:test_top] = 5
cookies[:test_middle] = 3
cookies[:test_bottom] = 1
You can also convert to JSON and then parse it when loading the cookie.
Newer versions of Rails include automatically serialization using the session object.