Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeController < ApplicationController
- before_filter :protect
- def protect
- allowed = ['127.0.0.1', '123.456.78.9']
- if not allowed.include? request.remote_ip
- # Render a 403 page
- render(:file => File.join(Rails.root, 'public/403'), :status => 403, :layout => false)
- return
- end
- end
- # This won't get executed for those not in the whitelist
- def index
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement