Skip to content

Instantly share code, notes, and snippets.

@forced-request
Last active April 18, 2017 23:46
Show Gist options
  • Save forced-request/2385c25519cfbbbd47be to your computer and use it in GitHub Desktop.
Save forced-request/2385c25519cfbbbd47be to your computer and use it in GitHub Desktop.
protect_from_forgery
def protect_from_forgery(options = {})
self.request_forgery_protection_token ||= :authenticity_token
prepend_before_filter :verify_authenticity_token, options
end
def verify_authenticity_token
unless verified_request?
logger.warn "WARNING: Can't verify CSRF token authenticity" if logger
handle_unverified_request
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment