Rails no route matches with nested resources

I know this question is very common with Rails, but I can't get any of the previous answers to work for me.

MyApplication::Application.routes.draw do resources :matters do resources :issues end 

I get the following routing error:

 No route matches {:action=>"show", :controller=>"issues", :matter_id=>#<Matter id: 2, name: "Wilson", user_id: nil, created_at: "2011-03-23 18:19:40", updated_at: "2011-03-23 18:19:40">, :id=>nil} 

I am trying to get the path as follows:

 <%= link_to issue.content, matter_issue_path(@matter, @issue) %> 

When I start the rake routes, it shows that I have a path:

 matter_issues GET /matters/:matter_id/issues(.:format) {:action=>"index", :controller=>"issues"} 

Any ideas why I get this error? Thanks!

+7
source share
1 answer

Try the matter_issues_path file (@matter, @issue)

It seems that I always encounter these pluralization errors with Rails routing.

+15
source

All Articles