Skip to content

Instantly share code, notes, and snippets.

@tommeier
Created Feb 28, 2012
Embed
What would you like to do?
Resque initializer
# Why use RAILS_ROOT and RAILS_ENV? Because this way we can tell our Sinatra app about the config file:
# $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb
require 'resque'
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
#Fire any resque errors to our airbrake configuration
require 'resque/failure/airbrake'
require 'resque/failure/multiple'
require 'resque/failure/redis'
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Airbrake]
Resque::Failure.backend = Resque::Failure::Multiple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment