out错误后设计sign

out错误后设计sign

本文介绍了在sign_out错误后设计sign_in的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些设计问题。签出后,当我第一次填写登录表单时,会写出验证错误

但是当我第二次提交表单时,我没有任何错误。签收成功。



我使用链接登出

  <%= link_to退出,destroy_user_session_path,:method => :删除%> 

在注册后,它会重定向我登录表单并写入验证错误:

但再次输入它的工作正常



我做错了什么?感谢提前!

解决方案

此错误消息是控制器中 authenticate_user!的原因。 >

我认为您的重定向已发送给某些具有方法的地方

  before_filter:authenticate_user! 

对于 sign_out ,默认情况下将重定向到 root_path 退出后查看重定向的详细信息。



而对于 sign_up devise将重定向到 root_path 或您要去的路径。 注册重定向后,请参阅此链接。 / a>



我希望这可能有助于您在代码中错过的地方。



尝试检查您的根在路由文件中。


I have a little problem with devise. After signing out, when i fill up "signing in" form first time it writes a validation error

but when i am submitting form second time i don't have any errors. And signs in successfully.

I do sign out using link

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

also, after signing up, it redirects me on signing in form and writes validation error:

but entering the same again it works fine

what I am doing wrong? Thanks in advance!

解决方案

This error message is cause from authenticate_user! in controller.

I think your redirection have sent you to some where that have the method

before_filter: authenticate_user!

For the after you sign_out by default devise will redirect you to root_path. See this link for detail for redirection after sign out.

And for the after sign_up devise will redirection you to root_path or the path that you want to go. See this link for after signup redirection.

I hope this might help where you miss in your code.

Try to check your root in route file.

这篇关于在sign_out错误后设计sign_in的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:13