0
任何人都可以解釋爲什麼我一直在生產中出現錯誤,但不在開發中?相關部分:Rails:生產中的操作錯誤,但沒有在開發中
get: /user/logout
ActionController::RoutingError (uninitialized constant User::SessionController):
activesupport/lib/active_support/inflector/methods.rb:229:in `block in constantize'
activesupport/lib/active_support/inflector/methods.rb:228:in `each'
activesupport/lib/active_support/inflector/methods.rb:228:in `constantize'
actionpack/lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
actionpack/lib/action_dispatch/routing/route_set.rb:54:in `controller'
actionpack/lib/action_dispatch/routing/route_set.rb:32:in `call'
journey/lib/journey/router.rb:68:in `block in call'
journey/lib/journey/router.rb:56:in `each'
journey/lib/journey/router.rb:56:in `call'
actionpack/lib/action_dispatch/routing /route_set.rb:600:in `call'
omniauth/lib/omniauth/strategy.rb:177:in `call!'
omniauth/lib/omniauth/strategy.rb:157:in `call'
omniauth/lib/omniauth/builder.rb:48:in `call'
airbrake/lib/airbrake/rack.rb:27:in `call'
路線:
Application1::Application.routes.draw do
match('/auth/:provider/callback' => 'session#create', :format => false)
root(:to => 'blog/archives#index', :format => false)
namespace(:user) do
match('/logout' => 'session#destroy', :format => false)
end
namespace(:blog) do
match('/archive/:slug' => 'archive#show', :format => false)
constraints(:page => /page\d+/) do
match('/archives/:page' => 'archives#index', :format => false)
end
end
end
我使用Rails 3.2.3最新Omniauth。
會話是一個自己的控制器,公共接口是/ usr/logout => session#destroy和/ auth /去會話#創建。我不希望將一個共同的(共享的)控制器分成更難以管理的部分。我可以直接將它與session#destroy在namspace外部進行匹配,但是它內部預計你的狀態,這是我不希望的,因爲這意味着當我在/ user /的其餘部分添加完成時,我在/ user中有一條路由命名空間之外。另外你指出的文檔非常廣泛,留下了很多需要解釋的內容:命名空間和我的問題。 – 2012-04-21 17:30:40