Devise sign_in after sign_out error

I have a little development problem. After discharge, when I first fill out the "signing" form, he writes a verification error

You need to login or register before proceeding.

but when I submit the form a second time, I have no errors. And the signs are successful.

I exit the link

<%= link_to "Sign out", destroy_user_session_path, :method => :delete %> 

also after registration, it redirects me upon entering the form and writes a verification error:

You need to login or register before proceeding.

but introducing it again, it works great

what am I doing wrong? Thanks in advance!

+1
source share
1 answer

You need to login or register before proceeding.

This error message is the reason from authenticate_user! in the controller.

I think your redirect sent you where there is a method

 before_filter: authenticate_user! 

If after sign_out by default devise redirects you to root_path . See this link for redirection after exiting for details.

And for the after sign_up method, devire redirects you to root_path or the path you want to use. See this link after registration redirection.

Hope this helps you skip the code.

Try checking your root in the route file.

+1
source

Source: https://habr.com/ru/post/985719/


All Articles