Rails 3 Devise,一切都路由到本地主机索引
因此,我按照 Railscasts 教程进行操作,一切正常,直到我单击注册表单上的“提交”。它给了我一个根本错误,然后我研究并发现答案是没有路线。所以我使用 root :to => 'home#index' 在我的路由文件中,然后允许我注册,然后重新定位到索引,但现在当我尝试访问注册或登录时,我会得到索引页面。
这是我的routes.rb 文件
Travel::Application.routes.draw do
devise_for :users
root :to => 'home#index'
end
So I followed the Railscasts tutorials, and everything works up until I click submit on my sign up form. It gave me a root error which I then researched and found that the answer is there is no route. So I used root :to => 'home#index' in my routes file, which then allowed me to sign up and then get relocated to the index, but now when I try to access the sign up or login, I get the index page.
Here is my routes.rb file
Travel::Application.routes.draw do
devise_for :users
root :to => 'home#index'
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您在登录后无法访问注册或登录页面。请先尝试访问
/users/sign_out
。It's because you can't access the sign up or login pages while already logged in. Try accessing
/users/sign_out
first.