我正在尝试使用devise_scope重定向我的/ login来设计控制器和视图。但同时我也想使用/ users / sign_in默认设计路径,这就是为什么我没有在设计中包含skip [:sessions]的原因。但是我收到了错误
undefined method `user_session_path' for #<Module:0x00564e34f44268
的routes.rb
devise_for :users, :class_name => '::User', :controllers => {
:registrations => "users/registrations",
:invitations => 'users/invitations',
:confirmations => 'users/confirmations',
:passwords => 'users/passwords'
}
devise_scope :user do
get 'login', :action => :new, :controller => 'devise/sessions'
end
色器件/会话/ new.html.erb
<div class="app-section-body">
<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => 'form-vertical', :spellcheck => 'false' }) do |f| %>
这适用于/ users / sign_in但在/ login
中抛出错误答案 0 :(得分:0)
您错过了/
get '/login'
您可以使用此
进行一些简化devise_scope :user do
get '/login', to: 'devise/sessions#new'
end