Gem resque 路由规则引起 rake routes 出错,求解

suupic · 2011年12月16日 · 最后由 Richie 回复于 2012年02月04日 · 2951 次阅读

在 routes.rb 中添加 mount Resque::Server.new, :at => "/resque"

rake routes 出错,但路由解析是正常的,web 界面也可以访问。求解决

DELETE /plans/:id(.:format)                          {:action=>"destroy", :controller=>"plans"}
/resque                                       {:to=>#<Sinatra::ShowExceptions:0x0000000566fcd8 @user1=#<Rack::Head:0x0000000566f8a0 @user2=#<Rack::NullLogger:0x0000000566f580 @user3=#<Rack::Protection::FrameOptions:0x00000005652bd8 @user4=#<Rack::Protection::IPSpoofing:0x00000005651e40 @user5=#<Rack::Protection::JsonCsrf:0x00000005650ab8 @user6=#<Rack::Protection::PathTraversal:0x000000056466d0 @user7=#<Rack::Protection::XSSHeader:0x00000005629468 @user8=#<Resque::Server:0x000000055b12b0 @user9=:layout, @user10=nil, @user11=#<Tilt::Cache:0x000000055b1800 @user12={}>>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :except=>[:escaped_params, :session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:escaped_params, :session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:escaped_params, :session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :except=>[:escaped_params, :session_hijacking, :remote_token]}>, @options={:reaction=>:default_reaction, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :xss_mode=>:block, :frame_options=>:sameorigin, :except=>[:escaped_params, :session_hijacking, :remote_token]}>>>, @template=#<ERB:0x00000005670908 @user19=nil, @user20="#coding:US-ASCII\n_erbout = ''; _erbout.concat \"<!DOCTYPE html>\\n<html>\\n<head>\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\"/>\\n

换一种方式试下,去掉 routes 中的配置 mount Resque::Server.new, :at => "/resque" 在 config.ru 中加, run Rack::URLMap.new \ "/" => APP::Application, "/resque" => Resque::Server.new

多谢指点

不过在我的环境中,APP::Application 还是会报错 最后是注释掉原生的: #run Edm::Application 添加: run Rack::URLMap.new "/" => Edm::Application, "/resque" => Resque::Server.new

大功告成

恩,呵呵,我那给的 APP 只是一个例子,要换成你的 rails 的应用程序的名字

需要 登录 后方可回复, 如果你还没有账号请 注册新账号