0

我收到这样的错误:

uninitialized constant Mobile::OmniauthCallbacksController

这似乎是一个 routes.rb 问题。我究竟需要向我的命名空间添加什么才能使其正常工作?

这是路线范围:

  scope :module => :mobile, :as => :mobile do
    constraints(:subdomain => /m/) do
      devise_for :users, :path => "", :path_names =>
               { :sign_in => "login", :sign_out => "logout",
                 :sign_up => "signup" },
                 :controllers => {:sessions => "mobile/sessions" , :passwords => "mobile/passwords" , :confirmations => "mobile/confirmations" , :registrations => "mobile/registrations"}

      get "/home" => "home#index" , :as => "home"

    end
  end

在 routes.rb 文件的其他地方有这样的片段:

  devise_scope :user do
    get "auth/:provider" => "users/omniauth_callbacks#passthru"
  end

但我不确定如何让它在我正在工作的命名空间内工作。有什么想法吗?

谢谢!

4

1 回答 1

1

我相信问题可能在于您对控制器使用这些值:

 {:sessions => "mobile/sessions" , 
  :passwords => "mobile/passwords" , 
  :confirmations => "mobile/confirmations" , 
  :registrations => "mobile/registrations"
}

看起来代码正在进入这些控制器并试图OmniauthCallbacksControllerMobile.

于 2012-05-07T21:57:17.927 回答