Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I get devise to use my custom routes inside of the authenticate_user!

Alan Reid asked in Rails

I've declared custom routes in my app for a few of the devise actions, they are as follows:

devise_scope :user do
  get 'signup', to: 'devise/registrations#new', as: :signup
  get 'login', to: 'devise/sessions#new', as: :login
  get 'logout', to: 'devise/sessions#destroy', as: :logout
  get 'forgotten', to: 'devise/passwords#new', as: :forgotten
  get 'resend-confirmation', to: 'devise/confirmations#new', as: :resendconfirmation
end

However, when an unauthenticated user accesses a protected part of my site still gets redirected to /users/sign_in. How do I get devise to use my custom routes inside of the authenticate_user! before_action? to keep the whole experience of using my app the same.

Thanks all.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,387+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.