为什么我在Rails 3中遇到“无路由匹配”错误?

时间:2011-06-01 00:42:23

标签: ruby-on-rails-3 routes rails-3-upgrade

我有我的haml:

= link_to("Calls Today", todo_path)

在我的routes.rb中:

match "todo/today" => "todo#show_date"
match "todo/today/campaign/:id" => "todo#show_date", :as => "todo"

我的理解是'todo_path'应该找到todo controller和show_date。

1 个答案:

答案 0 :(得分:3)

这条路线:

match "todo/today/campaign/:id" => "todo#show_date", :as => "todo"

预计会出现一个id参数。因此,您的link_to应该是:

= link_to("Calls Today", todo_path(:id => your_id))