2010-12-09 3 views
3

저는 Devise를 사용하고 있습니다. 이제는 'admin'네임 스페이스로 물건을 옮기려고합니다. 내가네임 스페이스의 Devise - ActionController :: RoutingError (경로 일치 {: action => "new", 컨트롤러 => "devise/sessions"})

before_filter :authenticate_user! 

을 가지고 있지만이 호출 될 때 발생 내 컨트롤러 중 하나에서

namespace :admin do 
    devise_for :users, :controllers => { :registrations => "admin/users/registrations" } 
end 

:

ActionController::RoutingError (No route matches {:action=>"new", :controller=>"devise/sessions"}): 

어떤 아이디어

나는처럼 보이는 경로가 ?

+1

RegistrationsController는 어떻게 보이나요? –

답변

1

나는이 일을 해요 :

scope '/admin' do 
    devise_for :admins 
end 
0
이에 대한 해결 방법은 namespace 블록의 외부 devise_for path 옵션을 사용하여 이동하는 것입니다

:

devise_for :users, :path => '/admin', 
        :controllers => { :registrations => "admin/users/registrations" } 
namespace :admin do 
    # other resource controllers 
end 

은 아마이 우아 아니다 (또는 직관적 인), 그러나 그것은 나를 위해 일한다! (가능성이 게시물 이후 변경된)가 고안 문서 당으로

3

, 다음과 같은 지침을 사용할 수 있습니다

# ... 
#  
# Notice that whenever you use namespace in the router DSL, it automatically sets the module. 
# So the following setup: 
# 
#  namespace :publisher do 
#  devise_for :account 
#  end 
# 
# Will use publisher/sessions controller instead of devise/sessions controller. You can revert 
# this by providing the :module option to devise_for. 
#  
# ... 

희망이 누군가를하는 데 도움이됩니다.

관련 문제