0

我正在尝试添加一条路线,使我能够将两个“文章”合并在一起,但无论我尝试什么,当路线实际上似乎匹配时,我都会不断收到“无路线匹配”。

在我看来:

<%= label_tag(:merge_with, "Article ID:") %>
<%= text_field_tag(:merge_with) %>
<%= button_to "Merge", {:controller=>'admin/articles', :action=>'merge_article'}, :method => :post %>

从我的路线.rb:

match 'articles/:id/merge' => 'articles#merge_article', :via => :post, :as => 'merge_article'

rake 路由的输出:

merge_article POST /articles/:id/merge(.:format) {:controller => "articles", :action => "merge_article"}

页面留言:

没有路线匹配 {:controller => "admin/articles", :action => "merge_article"}

4

1 回答 1

0

您的路线需要id. 你需要:id

{ :controller=>'admin/articles', :action=>'merge_article', :id => some_id }

或使用

merge_article_path(some_id)
于 2013-03-13T09:39:56.600 回答