Skip to content

Instantly share code, notes, and snippets.

@dannymcc
Created June 21, 2012 18:16
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 dannymcc/2967519 to your computer and use it in GitHub Desktop.
Save dannymcc/2967519 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
before_filter :protect
protect_from_forgery
def protect
@ips = ['127.0.0.1', '116.155.117.121']
if not @ips.include? request.remote_ip
# Check for your subnet stuff here, for example
# if not request.remote_ip.include?('127.0,0')
render :text => "You are unauthorized"
return
end
end
end
@caseyprovost
Copy link

if !@ips.include?(request.remote_ip)

@dannymcc
Copy link
Author

Thanks Casey, it still doesn't seem to be working. It's difficult to test locally though so I can't work out what's wrong!

@caseyprovost
Copy link

caseyprovost commented Jun 22, 2012 via email

@dannymcc
Copy link
Author

dannymcc commented Jun 22, 2012 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment