1
我得到这个错误:为什么我在Rails中找不到路由匹配错误?
Started POST "/admin/reports/2/backfill" for 127.0.0.1 at Thu Dec 29 16:09:00 -0500 2011
ActionController::RoutingError (No route matches "/admin/reports/2/backfill"):
当我张贴这种形式:
<%=form_for @report, {:url => report_backfill_path(@report.id), :method => :post} do |f| %>
<%=label_tag(:days, "number of days to backfill")%>
<%=select_tag(:days, options_for_select((1..100).to_a.map{|i| [i,i]}))%>
<%=f.submit "backfill!" %>
<% end %>
但路线是指,从我耙路线命令检查输出:
report_backfill POST /admin/reports/:report_id/backfill(.:format) {:controller=>"reports", :action=>"backfill"}
包含此表单的页面呈现良好,只是在我发布时发现错误。
任何想法?
是发布还是放?这是我最常见的错误... – DGM 2011-12-29 21:20:11
这是一篇文章,我仔细检查了几次。 – 2011-12-29 21:20:29
看起来像我必须使用form_tag,而不是form_for,因为我不张贴到其中一个标准路由(也不包括标准对象字段)。没有任何意义,表单呈现几乎相同。 – 2011-12-29 21:27:40