I'm not sure about routes.rb, but a before filter in application.rb would certainly be one place to do this.