如何配置config.ru以使Resque在Heroku上运行?

时间:2011-10-17 13:58:27

标签: ruby-on-rails heroku resque

我的config.ru文件中包含以下内容,但是Heroku下面的错误会崩溃。

require ::File.expand_path('../config/environment',  __FILE__)
run Picasa::Application

require 'resque/server'
run Rack::URLMap.new \
  "/" => Picasa::Application,
  "/resque" => Resque::Server.new

错误:

2011-10-17T13:54:01+00:00 heroku[web.1]: Starting process with command `thin -p 30071 -e production -R /home/heroku_rack/heroku.ru start`
2011-10-17T13:54:06+00:00 app[web.1]: /app/.bundle/gems/ruby/1.8/gems/railties-3.0.9/lib/rails/application.rb:168:in `call': undefined method `reverse_merge!' for #<Rack::URLMap:0x7fd215e4f720> (NoMethodError)
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `send'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:73:in `to_app'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23:in `inject'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:73:in `each'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:73:in `inject'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:73:in `to_app'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:63:in `map'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:18
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11:in `new'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
2011-10-17T13:54:06+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1:in `new'
2011-10-17T13:54:06+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1
2011-10-17T13:54:06+00:00 heroku[web.1]: Process exited
2011-10-17T13:54:08+00:00 heroku[web.1]: State changed from starting to crashed

1 个答案:

答案 0 :(得分:4)

看起来你正在运行Rails 3.0.9,在这种情况下你需要做的就是

mount Resque::Server.new, :at => "/resque"
您的routes.rb文件中的