Created
April 18, 2012 01:01
-
-
Save jonpaul/2410242 to your computer and use it in GitHub Desktop.
before_filter methods
This file contains hidden or 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 | |
def is_a_help? | |
unless current_user.admin? | |
redirect_to :back, notice: 'Sorry.' | |
end | |
end | |
end |
This file contains hidden or 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 Lights > ApplicationController | |
before_filter :is_a_help? | |
def index | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment