Search code examples
ruby-on-rails-3routesrails-3-upgrade

why am I getting a 'no route matches' error in Rails 3?


I have in my haml:

= link_to("Calls Today", todo_path)

And in my routes.rb:

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

My understanding is that 'todo_path' should find todo controller and show_date.


Solution

  • This route :

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

    Expects an id parameter. Therefore, your link_to should be like :

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