Many times we face some serious issue while dealing with web page visibility after and before login and that happens due to browser’s property to cache pages.
Here is the solution to avoid browser caching problem using HTML and rails 3 :-
In application_controller.rb add
before_filter :set_cache_buster def set_cache_buster response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate' response.headers['Pragma'] = 'no-cache' response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT' end
But above solutions does not work for all browsers. Like you will still face issue in browser like safari and in some versions of IE too. So to avoid it all, in layouts/application.html.erb
Now, it will work like a charm…cheers 🙂