rails devise gem redirect loop -


I am using a devise gem with a Rail 4.1.4 app, and adding some custom key-value additions to it Is required

I override the following methods

after_sign_in_path_for (resource)
after_sign_up_path_for (resource)
According to the after_update_path_for (resource)
after_resetting_password_path_for (resource) methods specified here:

However, signing in However, with the following output I after_sign_in_path _for I enter several times:

Obtain "/ user / sign-in" for 127.0.0.1 on 2014/07/07 - 10-08 22:56: 45 +0530 Processive Davis :: Sessions Controller # HTML as the new
Select user load (0.3ms) "Users". * "User" by "user" "id" = 1 "user" by ORDER. "ID" ASC limit1
http: // localhost: 3000 / users / sign_in Filters series has been redirected: need_no_authentication rendered or guided full 302 3ms (ActiveRecord: 0.6ms )

Every time I finally redirected to the root path (the browser temporarily redirects me to the root before the redirect loop shows the error message).

Edit:

Then it is known that I have 2 different models (user and administrator), in this line of code, After_sign_in_path_for :

sign_in_url = url_for (: action = & gt; 'new' ,: controller = & gt; 'session', only: path = & gt; wrong, protocol = & Gt; 'http')

Creating url is "http: // localhost: 3000 / admins / sign_in" "http: // localhost: 3000 / Users / sign_in "instead of

How do I create a url_ for the user's model and not the admin model?

Thank you!

Yourself went to this issue for any reason, url_for The administrator looks the default (do not know why) The good news is that you do not have to use url_for to complete this

Instead, get rid of

  sign_in_url = url_for (: action = & gt; 'new' ,: controller = & gt;,: = _path = & gt; wrong, protocol = & gt; ; 'Http')   

and

  Change if request.referer == sign_in_url   with  P> 
  Aug R request.referer == new_user_session_url   

The helper creates your code cleaner and allows you to specify which system model you want.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -