Ruby on rails Rails:生产中的操作错误,但开发中没有

Ruby on rails Rails:生产中的操作错误,但开发中没有,ruby-on-rails,omniauth,ruby-on-rails-3.2,Ruby On Rails,Omniauth,Ruby On Rails 3.2,有人能解释为什么我在生产中不断出错,但在开发中却没有?相关部分: get: /user/logout ActionController::RoutingError (uninitialized constant User::SessionController): activesupport/lib/active_support/inflector/methods.rb:229:in `block in constantize' activesupport/lib/active_suppo

有人能解释为什么我在生产中不断出错,但在开发中却没有?相关部分:

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一起使用。

您已经创建了一个名称空间用户,因此您应该将定义销毁操作的会话控制器放置在以下路径中:

/app/controllers/user/session_controller.rb
然后你可以做一些事情,比如:

/app/controller/user/base\u controller.rb
中创建一个文件,该文件定义:

class User::BaseController < ApplicationController
 # Whatever you want here
end

阅读有关名称空间和路由的更多文档。

会话本身就是一个控制器,其公共接口为/usr/logout=>Session#destroy和/auth/going to Session#create。我不希望将一个公共(共享)控制器拆分为多个部分,从而使管理更加困难。我可以直接将它与namspace外部的会话#destroy进行匹配,但在它内部,它需要您所说的内容,这是我不希望看到的,因为这意味着当我在/user/I的其余部分中完成添加时,我在/user内有一条路由,在命名空间外。另外,您所指的文档内容非常广泛,并且留下了很多需要解释的内容:名称空间和我的问题。
class Users::SessionsController < User::BaseController
 def destroy
  # whatever you want destroy to do..
 end
end