RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: jamiecobbett
I wanted only Users with the admin attribute set to true to access resque-web.
Since we're using Devise, the current user is accessible like this:
So I made the below off the back of the example here:
class SecureResqueServer < Resque::Server
redirect '/' unless request.env['warden'].user.admin
If we were using Devise's "roles" (where each role has it's own table) we could simply do this in the routes file:
mount Resque::Server, :at => "/resque"