1

am using devise for my authentication,i tried customizing the users/sign_in route to users/login but i keep getting this error

NoMethodError in Devise::Sessions#new
undefined method `user_session_path' for #<Module:0x651c828>

It highlights this line which is in the sign_in view

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>

below is my route.rb

devise_scope :user do
  get "login", to: "devise/sessions#new"
  post "login", to: "devise/session#new"
end
2
  • 1
    Please help us to better assist you: edit your question and format it nicely Commented Oct 14, 2015 at 21:26
  • 1
    Do you really want to set up additional routes (meaning that /users/sign_in is still available) or do you just want to change the names of the paths? Commented Oct 14, 2015 at 21:59

1 Answer 1

1

If you don't need to ADD new paths to devise, and you simply want to change the path names, then this is a better option:

devise_for :users, path: '', path_names: 
  {:sign_in => 'login', :sign_out => 'logout'}

Though - if you're altering the controllers (using your own instead of devise stock controllers) then this doesn't work well.

Platformatec has some really great documentation though, you should pour through it and mix and match to meet your needs. https://github.com/plataformatec/devise/wiki/How-Tos

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.