I set a cookie on Rails like this,
cookies[:account] = { :value => @account.to_s, :expires => 3.month.from_now }
Which seems to be working fine, a simple debug @account shows
--- myvalue
…
But when calling the cookie using jQuery.Cookie It return a "[object Object]" instead.
> $.cookie('account');
"[object Object]"
Any idea why is this happening and how to solve it?
[object Object]is the return value fromObject.toString(), so that means that $.cookie(‘account’) is returning a non-Number, non-String object.On way to start figuring out what’s in the return value (in an effort to help you determine what’s in the object returned) is to loop over the properties to figure it out.
So, like this: