Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class SomeController < ApplicationController
  2. before_filter :protect
  3.  
  4. def protect
  5. allowed = ['127.0.0.1', '123.456.78.9']
  6. if not allowed.include? request.remote_ip
  7. # Render a 403 page
  8. render(:file => File.join(Rails.root, 'public/403'), :status => 403, :layout => false)
  9. return
  10. end
  11. end
  12.  
  13. # This won't get executed for those not in the whitelist
  14. def index
  15. end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement