Skip to content

Instantly share code, notes, and snippets.

@geronimod
Created August 21, 2014 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geronimod/5a98d84a320e816f797c to your computer and use it in GitHub Desktop.
Save geronimod/5a98d84a320e816f797c to your computer and use it in GitHub Desktop.
Example of ResqueWeb for RoR 2.3
class ResqueWeb
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'].include? '/resque'
resque_web = Rack::Builder.new {
map "/resque" do
use Rack::Auth::Basic, "Resque" do |user, password|
user == 'xxxx' && password == 'xxxx'
end
run Resque::Server.new
end
}.to_app
resque_web.call env
else
@app.call env
end
end
end
Rails.configuration.middleware.use 'ResqueWeb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment