我收到了这样的错误:
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
但我不确定如何让它在我工作的命名空间内工作。有什么想法吗?
谢谢!
答案 0 :(得分:1)
我认为问题可能在于您对控制器使用这些值:
{:sessions => "mobile/sessions" ,
:passwords => "mobile/passwords" ,
:confirmations => "mobile/confirmations" ,
:registrations => "mobile/registrations"
}
看起来代码进入这些控制器并尝试从OmniauthCallbacksController
范围内加载Mobile
。