2012-02-05 40 views
1

我有一个设计小问题。注销后,当我填写“签署”的形式首次写入验证错误设计sign_in后sign_out错误

You need to sign in or sign up before continuing.

,但是当我提交表单第二次我没有任何错误。并成功登录。

我登出使用链接

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

也,签约后,它重定向我上登入的形式和写入验证错误:

You need to sign in or sign up before continuing.

但进入一样了,它工作正常

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

+0

您是否找到解决方案? – Robert 2014-06-26 19:00:47

回答

1

You need to sign in or sign up before continuing.

此错误消息是由控制器中的authenticate_user!引起的。

我想你重定向已经向您发出一些地方有方法

before_filter: authenticate_user! 

对于后您sign_out默认色器件将您重定向到root_pathSee this link for detail for redirection after sign out.

而对于后sign_up色器件将重定向用户到root_path或你想要去的路径。 See this link for after signup redirection.

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

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

+0

在这种情况下,我猜你的根目录已设置为一些具有authenticate_user的控制器! – Rafaiel 2012-02-06 08:30:05