Hi,
I have a helper method to get a date from a cookie (in application
helper) that looks like this:
def getToday
if(cookies[:date])
cookies[:date].to_date
else
Date.today
end
end
I set the cooke date using a before_filter method in the application
controller, reading a GET param:
before_filter :save_today_as_cookie
def save_today_as_cookie
if params[:d]
cookies.delete :date
cookies[:date] = {
:value => params[:d],
:expires => 1.hours.from_now
}
end
end
This works fine, but if I want to change the date by passing a new
date parameter, I have to reload the page twice that it takes affect.
The cookie changes instantly. It seems to me, that the result of the
helper function is cached for one more load.
Setting expiring headers or etags did not help.
I’m using Rails 2.3.2 and no special cache plugin/gem/configuration.
The cookie changes instantly. It seems to me, that the result of the
helper function is cached for one more load.
Setting expiring headers or etags did not help.