Rails 3 - 竖起大拇指 - 路由问题?
你好 我有一个正在使用 Thumbs_up 的项目,当您输入单个零售商时,您可以对其投赞成票或反对票。它就像一个魅力。
但现在我尝试将此功能添加到所有零售商的索引页面中,当我尝试使用表单发布操作时,它开始给我错误。
这是我在“索引”页面上收到的错误。
Started POST "/retailers/lensesonly/vote_down" for 127.0.0.1 at 2011-05-09 13:02:02 +0200
ActionController::RoutingError (No route matches "/retailers/lensesonly/vote_down"):
然后,当我进入零售商的单个页面并对其进行投票时,它会给我这个。
Started POST "/retailers/lenssavers/vote_down" for 127.0.0.1 at 2011-05-09 13:05:13 +0200
Processing by RetailersController#vote_down as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"asd.../0i5fcCO7+asd=", "commit"=>"", "id"=>"lenssavers"}
为什么会这样呢?我做错了什么?当您在浏览器(FF-Firebug)中查看时,这些表单看起来完全相同。
Hi
I've got a project where I'm using Thumbs_up, when you enter a single retailer you can either vote it up or down. It works like a charm.
But now I try to add this feature to a index page of all retailers and it starts to give me error when I try to post the action with a form.
This is the error I receive on the "index" page.
Started POST "/retailers/lensesonly/vote_down" for 127.0.0.1 at 2011-05-09 13:02:02 +0200
ActionController::RoutingError (No route matches "/retailers/lensesonly/vote_down"):
And then when I enter the single page of a retailer and votes it up it gives me this.
Started POST "/retailers/lenssavers/vote_down" for 127.0.0.1 at 2011-05-09 13:05:13 +0200
Processing by RetailersController#vote_down as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"asd.../0i5fcCO7+asd=", "commit"=>"", "id"=>"lenssavers"}
Why is it like this? What am I doing wrong? The forms look exactly the same when you look at it in a browser (FF-Firebug).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您显示的网址不同:
是工作网址。
虽然这个失败了:
您是否在
routes.rb
中缺少lensesonly
的定义?您可以通过在 Rails 根文件夹中的命令行上运行
rake paths
轻松检查路线。The url's you are showing are different:
is the working url.
While this one fails:
Are you missing a definition in your
routes.rb
forlensesonly
?You can easily check your routes by running
rake routes
on the command-line, in your rails root folder.