I've set up the Resque-web interface to work with my rails 3 app but it doesn't work in either development or production environments. My set up is as follows, and going to localhost:3000/resque just gives me the 404 page I've set up.
Routes.rb
mount Resque::Server.new, :at => "/resque"
Resque initializer
require 'resque'
require 'resque/server'
if Rails.env.development?
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => 'localhost', :port => '6379')
else
uri = URI.parse(ENV["REDISTOGO_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end
Dir["#{Rails.root.to_s}/app/jobs/*.rb"].each { |file| require file }
Resque::Server.class_eval do
use Rack::Auth::Basic do |email, password|
user = User.authenticate( 'foo@bar.co.za', 'password' )
user && user.admin?
end
end
I have a route that matches '/:name'
to a 'model#index'
route must be confusing Resque so I've just mounted it to '/resque/web'