how to prevent the user from accessing the app.after logout with back button(rails only)

hi all after logging out of my site if i click back button it is going back to my app. how can i restrict this problem i have use before_filter also.

thanks in advance

It's a browser caching issue, so you need to tell the browser not to cache.

thanks for your reply i have added your code and i checked it. if i click back button after logout it is still going back to app but it is give me the error "

undefined method `username' for nil:NilClass" it shows it going back to app.

It's not "my code" - it's sample code from the Internet. Your error is now in your code - probably in the handling of controller actions when users are not logged in.

Several solutions in the before mentioned post were suggested. I used:

  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

I'm using Devise for authentication. All works like a charm.