Reputation: 173
I am trying to use devise_scope to redirect my /login to devise controller and views. But at the same time I want to use /users/sign_in default devise path also, that's why I didn't include skip [:sessions] in devise for. But I am getting error
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
devise/sessions/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| %>
This works with /users/sign_in but throws error in /login
Upvotes: 0
Views: 210
Reputation: 2575
You're missing the /
in get '/login'
You can simplify it a bit with this
devise_scope :user do
get '/login', to: 'devise/sessions#new'
end
Upvotes: 0