Verify yourself to prove that you are not a ROBOT! After verification the page will apear. Thanks for understanding.
I set the cookie using an integer
cookies[:which_link] ||= 0
It seems to convert it from an integer to a string, because there are no complaints. I do a cookies[:which_link].class and it comes back string.
I need to do something like this in my app-
cookies[:which_link] -= 1 if params[:pages] == "previous"
but will not work, obviously, neither is to_i a remedy. Any workarounds for this before I have to consider using one of the Rack options?
In a regular Ruby hash, I input an integer, as a value and it remains so and shows it of the Integer class.
If I'm understanding what you need, I think to_i will work, you'll just need to rewrite your statement a bit. See the following example:
get '/' do
cookies[:test] ||= 0
cookies[:test] = cookies[:test].to_i + 1
You cannot add a String and a Fixnum but you can convert the String to a Fixnum and then add 1 to it. Then just set the value of that cookie to the new Fixnum which, as you've noted, works.