Skip to content

Instantly share code, notes, and snippets.

@forced-request
Created September 9, 2014 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forced-request/a209de2e7eb15f8bee25 to your computer and use it in GitHub Desktop.
Save forced-request/a209de2e7eb15f8bee25 to your computer and use it in GitHub Desktop.
Overloading handle_unverified_request to protect from forgery
class ApplicationController < ActionController::Base
protect_from_forgery
# Overload handle_unverified_request to ensure that
# exception is raised each time a request does not
# pass validation.
def handle_unverified_request
raise(ActionController::InvalidAuthenticityToken)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment