我试图在用户登录后设置根URL但问题出在用户登录后,他们被重定向到主页但不是我想要的页面。这是代码。
devise_scope :user do
authenticated :user do
# root to: 'dashboard#index', module: 'client'
namespace :client do
root to: 'dashboard#index', as: :dashboard
end
end
unauthenticated :user do
root to: 'devise/registrations#new', as: :unauthenticated_root
end
end
用户应该被重定向到/ client / index,而不是重定向到\。
答案 0 :(得分:0)
我找到了让它运转的方法。
namespace :client do
get 'dashboard/index'
end
devise_for :users, class_name: 'FormUser', controllers: { omniauth_callbacks: 'omniauth_callbacks', registrations: 'registrations' }
devise_scope :user do
# authenticated :user do
# # root to: 'dashboard#index', module: 'client'
# namespace :client do
# root to: 'dashboard#index', as: :dashboard
# end
# end
unauthenticated :user do
root to: 'devise/registrations#new', as: :unauthenticated_root
end
end
如果有更好的方法,请告诉我