我是Rails应用的初学者.我已将devise gem用于身份验证目的.当我登录其显示错误时:未定义的局部变量或方法'sign_out_path'
I'm beginner in rails application. I have used devise gem to authentication purpose. when I log in its showing error: undefined local variable or method `sign_out_path'
我该如何解决这个问题?
How can I solve this problem?
推荐答案可能有两个原因:
先行耙道.查看输出,看看是否可以看到以"devise"开头的任何路由.
First run rake routes. Have a look through the output and see if you can see any routes beginning with "devise".
如果可以看到一个名为"destroy_user_session"的名称,那么实际上这是您需要用于注销链接的名称,而不是"sign_out_path".在这种情况下,请转到放置退出链接的视图,然后用"destroy_user_session_path"替换帮助程序.
If you can see one called "destroy_user_session" then this is actually the name you need to use for your sign out link, and not "sign_out_path". In that case, go to the view where you have put your sign out link and replace the helper with "destroy_user_session_path".
更多推荐
未定义的局部变量或方法`sign
发布评论