How would I write something like this in ruby
if( !cookies['isActive']){
cookies['isActive'] = true
}
I was thinking of putting this in the application controller. Or maybe there is a better way.
I’m basically wanting to set a cookie if one is not already set. It should only live for the time the browser is open.
Then on the application view side I want to be able to see if that cookie is set if it isn’t then I want to be able to run some script.
Very simple operator:
||=.Edit according to the comment:
To read/use it in the view, e.g: