Created
May 5, 2015 16:30
-
-
Save prakashmurthy/476423678fa517537445 to your computer and use it in GitHub Desktop.
catching ActionController::InvalidAuthenticityToken
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
rescue_from ActionController::InvalidAuthenticityToken, with: :show_errors | |
before_filter { |c| User.current_user = c.current_user } | |
... | |
private | |
def show_errors | |
logger.info "\n###\n Came to show errors method! flash: #{flash.inspect}\n###\n" | |
flash.keep[:notice] = "She has some cookies for you" | |
redirect_to home_url, alert: "Cookies are bad!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment