问题 - 我不知道如何将设计中的new_user_session
路由设置为Rails app中的根路径。
Rails.application.routes.draw do
devise_for :users
resources :dashboard
root to: "home#index"
答案 0 :(得分:1)
将此行放在routes.rb
中devise_scope :user do
root :to => 'devise/sessions#new'
end
您需要设置默认会话路由。
答案 1 :(得分:0)
替换为。
devise_for :users, :controllers => {:registrations => "registrations", :sessions => "sessions"}
devise_for :users do
get '/users/sign_in', :to => 'devise/sessions#new', :as => :new_user_session
get '/users/sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
end
和root to
devise_scope :user do
get "/" => "sessions#new"
end