나는 devise 사용자 모델을 만들었습니다.Devise가 사용자 유형별로 다른 루트 경로를 설정했습니다.
- 고객
- 관리자 나는이 '정상'모델 생성 bij 이룬
: 고객 및 관리자에게 사용자의 2 종류가 있습니다. 이 두 모델과 같이, 사용자 모델에서 상속됩니다
class Customer < User
사람이 알고 있나요 어떻게 설정 사용자의 유형별 루트 경로를 할 수 있습니다. 나는 이런 식으로 뭔가를 원하는 :
authenticated :customer do
root :to => "customer/dashboard#index"
end
authenticated :admin do
root :to => "admin/dashboard#index"
end
UPDATE :
root :to => "pages#home", :constraints => lambda { |request|!request.env['warden'].user}
root :to => 'customer/dashboard#index', :constraints => lambda { |request| request.env['warden'].user.type == 'customer' }
root :to => 'admin/dashboard#index', :constraints => lambda { |request| request.env['warden'].user.type == 'admin' }
업데이트 된 답변을 질문과 대답 대신 이동하십시오. – Noz
처음 8 시간 동안 내 질문에 답할 수 없습니다 ... –