Rails 3 - 竖起大拇指 - 路由问题?

发布于 2024-11-06 02:23:27 字数 739 浏览 0 评论 0原文

你好 我有一个正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人间☆小暴躁 2024-11-13 02:23:27

您显示的网址不同:

/retailers/lenssavers/vote_down

是工作网址。
虽然这个失败了:

/retailers/lensesonly/vote_down

您是否在 routes.rb 中缺少 lensesonly 的定义?

您可以通过在 Rails 根文件夹中的命令行上运行 rake paths 轻松检查路线。

The url's you are showing are different:

/retailers/lenssavers/vote_down

is the working url.
While this one fails:

/retailers/lensesonly/vote_down

Are you missing a definition in your routes.rb for lensesonly ?

You can easily check your routes by running rake routes on the command-line, in your rails root folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文