Prabhakaran
Prabhakaran

Reputation: 4013

rails devise This webpage has a redirect loop

I have used the following route

  devise_for :users, path: '', path_names: { sign_in: 'login', sign_out: 'logout', registration: 'signup', sign_up: 'signup'}

  devise_scope :user do
    root to: 'devise/registrations#new'
    get 'signup', to: 'devise/registrations#new'
  end

As of above when I run localhost:3000 it will show registration page. But once I login/register using devise gem it redirect again back to root path so causing the following redirect loop How can I customize devise to redirect specific page after login.

Upvotes: 0

Views: 2539

Answers (1)

Joe Kennedy
Joe Kennedy

Reputation: 9443

There are a number of ways to do this with devise, and the devise wiki has around ten or so listed.

This page on the devise wiki should help: How To: redirect to a specific page on successful sign in.

This page should help as well How To: Redirect to a specific page on successful sign in and sign out.

I've also used the solution detailed on this wiki page: How To: Redirect back to current page after sign in, sign out, sign up, update

Upvotes: 1

Related Questions