RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ciscoriordan
Thanks. If you use .try(:admin) instead, the redirect works correctly even if you aren't logged in:
class Resque::SecureResqueServer < Resque::Server
redirect '/' unless request.env['warden'].user.try(:admin)
That also uses the Resque:: namespace and is loaded by Rails automatically if you use it in e.g. app/initializers/resque_auth.rb.
In your routes.rb, you would include:
mount Resque::SecureResqueServer, :at => "/resque"