assaf/vanity — Issue #79: Vanity and Resque do not play well together
Author: rodrigob
Created: 2011-10-27 14:58:26+00:00
State: open

When launching rake resque:work on my rails 3.1 application I get an "undefined 'metric'" error. Seems like resque inspects the milestone files _before_ Vanity is loaded. Any idea on how I can fix this ?

Using the latest vanity from git, and the latest resque gem.

Thanks for the support !

````
rake resque:work
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute resque:setup
** Execute resque:preload
rake aborted!
undefined method `metric' for main:Object
path_to_my_ruby_app/app/experiments/metrics/milestone_one_visits.rb:2:in `'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `load'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:456:in `block in load_file'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:455:in `load_file'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:302:in `depend_on'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:214:in `require_dependency'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:416:in `each'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:416:in `block in eager_load!'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:414:in `each'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:414:in `eager_load!'
/home/rodrigob/.rvm/gems/ruby-1.9.2-p290/gems/resque-1.19.0/lib/resque/tasks.rb:47:in `block (2 levels) in '
```
(and more....)