Skip to content

Instantly share code, notes, and snippets.

@joho
Created November 25, 2010 23:25
Show Gist options
  • Save joho/716068 to your computer and use it in GitHub Desktop.
Save joho/716068 to your computer and use it in GitHub Desktop.
possibly the funniest controller before filters we have in our codebase
class AccountsController < ActionController::Base
before_filter :lock_out_annoying_scammers
def lock_out_annoying_scammers
   if signed_in_user && signed_in_user.email =~ secret_hacker_regexp
     logger.warn 'One of those annoying scammers has tried to access the accounts controller'
     redirect_to 'http://www.amazon.com/Hackers-Jonny-Lee-Miller/dp/6305047456/' and return
   end
 end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment