Ira Herman Ira Herman - 1 year ago 112
Ruby Question

How do I use Devise to secure the delayed_job_web interface?

I'm using the delayed_job_web gem to monitor delayed jobs.

It is accessible using this line in my routes.rb:

match "/delayed_job" => DelayedJobWeb, :anchor => false

Every other area of my site requires a login using the Devise gem. How do I make this require a login too?

In the readme, they suggest adding the following to the config.rb:

if Rails.env.production?
DelayedJobWeb.use Rack::Auth::Basic do |username, password|
username == 'username'
password == 'password'

But that just uses plain text browser authentication.

I tried something similar to the railscast on resque, and I think it's on the verge of working but giving me a redirect loop now:

authenticate :admin do
mount DelayedJobWeb, :at => "/delayed_job"

Any thoughts on why would it be giving a redirect loop?


Answer Source

Use authenticated instead of authenticate as described here:

Works for me!