Created
September 8, 2012 17:28
-
-
Save geronimod/3677603 to your computer and use it in GitHub Desktop.
Authorization by ip
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
# foo controller | |
AUTHORIZED_IPS = [127.0.0.1, ...] | |
before_filter :authorize_by_ip | |
def authorize_by_ip | |
redirect_to login_path, :warning => "access denied" unless AUTHORIZED_IPS.include? request.remote_ip | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment