New Discussion

Notifications

You’re not receiving notifications from this thread.

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

0
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.

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.