I’m getting the gsub error. How do I make my ‘value’ hash a string and
then decode it back to its original Hash type? Any example code would
be helpful here.
Guys, this is definitely not working in Rails and other people have
gotten
gsub errors for this. Can somebody tell me how to safely store the
value
into the cookie as a string and then retrieve that value back into a
Hash?
Guys, this is definitely not working in Rails and other people have gotten
gsub errors for this. Can somebody tell me how to safely store the value
into the cookie as a string and then retrieve that value back into a Hash?
Of course it won’t work. Even if it let you set the value, when you
later retrieve the cookie it’s just a string, and you can’t convert it
back into a hash. Just marshal it then base64 encode it, then
decode/unmarshal it when you read it back. Not that I suggest doing
that, I think it’s crazy, but it will work.
Chris
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.