undefined local variable or method `sign_out_path'

房东的猫 提交于 2019-12-24 06:58:07

问题


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?


回答1:


There could be two reasons for this:

  1. You have not got the correct routes defined in your routes configuration file
  2. You have used a path helper for an existing route but mistakenly used the wrong name

First run rake routes. Have a look through the output and see if you can see any routes beginning with "devise".

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".



来源:https://stackoverflow.com/questions/19952066/undefined-local-variable-or-method-sign-out-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!