[英]rails3 devise - no route matches “/sessions/user”
it is the first time I am working with devise and I am a confused by the massive amount of files and configuration options. 这是我第一次使用设计,我对大量文件和配置选项感到困惑。 Before installing devise, I used the nifty:authentication from ryan bates - which I didn't delete before installing devise and I guess now my routes and/or controllers are a little screwed up.
在安装设备之前,我使用了漂亮的:来自ryan bates的身份验证 - 我在安装设备之前没有删除它,我想现在我的路由和/或控制器有点搞砸了。
well, after singing in on /users/sign_in devise tries to redirect me to 好吧,在on / users / sign_in devise中唱歌后试图将我重定向到
http://localhost:3000/sessions/user
but I get the error: 但我得到错误:
No route matches "/sessions/user"
I don't know where is the error, any help appreciated 我不知道错误在哪里,任何帮助表示赞赏
I put all the relevant code in a gist: https://gist.github.com/972058 我将所有相关代码放在一个要点: https : //gist.github.com/972058
thanks in advance 提前致谢
In my case, I had a session controller which was causing issues. 就我而言,我有一个导致问题的会话控制器。 Removing resources :sessions from the routes file should solve the problem.
删除资源:路由文件中的会话应该可以解决问题。 That was because I had previously created a session manager.
那是因为我之前创建了一个会话管理器。 Once gone, I did not see the issue again.
一旦消失,我再也没有看到这个问题。
That's because you don't have root path in your routes. 那是因为您的路线中没有根路径。 As you can read in devise page: https://github.com/plataformatec/devise
正如您可以在设计页面中阅读: https : //github.com/plataformatec/devise
After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect.
登录用户,确认帐户或更新密码后,Devise将查找重定向的作用域根路径。 Example: For a :user resource, it will use user_root_path if it exists, otherwise default root_path will be used.
示例:对于:user资源,如果存在,则使用user_root_path,否则将使用默认的root_path。 This means that you need to set the root inside your routes
这意味着您需要在路径中设置根
To specify redirect page you need to do this https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in 要指定重定向页面,您需要执行此操作https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in
btw. 顺便说一句。 you don't need sessions controller to make it works
你不需要会话控制器来使它工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.