Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Created May 13, 2010 10:27
Show Gist options
  • Save cheeyeo/399702 to your computer and use it in GitHub Desktop.
Save cheeyeo/399702 to your computer and use it in GitHub Desktop.
Clearing session
# something trivial but might be helpful if you want to implement clearing the session hash when the user presses the
# Back button
# used in IQF project when the email contact link on top right of page has to show the title of current page
def clear_session
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
def my_own_controller_action
.....
clear_session
# rest of code
end
# or use it in a before_filter
# e.g. before_filter :clear_session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment