librelist archives

« back to archive

Resque in Rails 3

Resque in Rails 3

From:
Sam Granieri
Date:
2010-04-29 @ 19:40
I've figured out how to integrate Resque into a Rails 3 application
easily. Here's how:

First, install json and resque in your gemfile,

Then, put either one of these in your routes file (They both do the same thing)

mount Resque::Server.new, :at => "/resque"
(which converts to)
match "/resque", :to=>Resque::Server.new, :anchor => false

You can stick this in the routes file or in config/initializers/resque.rb

require 'resque/server'
Resque::Server.use Rack::Auth::Basic do |username, password|
  username == YOUR_USERNAME
  password == YOUR_PASSWORD
end

Another note: As it stands now, Passenger will treat a rails 3 app
with config.ru at the top level as a Rack application (without memory
savings). If you remove config.ru , it'll be recognized as a rails
application and most importantly the routes above will still work.

Or you could just use unicorn :)

-- Sam Granieri