Log-in Logout application

I have created a application of log-in and logout using session. but
when i click on logout. then i saw a page that says "you are logged
out".
But the problem is that if i click the back button of my browser, then
it redirect me to the previous page. so how can i prevent from this
situation. My session is working fine because when i refresh my page
then the login screen appear.

Yes, maybe your session is working fine..

But you need to add more..
example..

if your session is nil? or blank?
render something.
or redirect to a page you want to be seen.

may there is problem of browser cookies. Is there any way to clear the cookies when we click on logout??

It will tell the browser not to cache this page.

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

pls find this attachment and use this code and pls tell me what the problem is there

http://www.adrive.com/public/be4fc1d8c4a3989fe5e9c161508220ae91f812ae2eccf3f013811eb81beb9ab9.html