Reputation: 5325
Not sure what I am missing. First off this is a valid route if I manually navigate to it...
/orientations/1/registrations
This shows me all registrations associated with the first orientaiton. Now I am trying to create a link_to to these routes in my view. Here is the output of rake routes...
http://pastie.org/pastes/8440065/text
In my view I am trying to do...
<%= link_to "R", orientation_registration_path(orientation) %></li>
...and the error I am getting is...
No route matches
{
:action => "show",
:controller => "registrations",
:orientation_id => #<Orientation
id: 1,
class_date: "2013-10-17",
class_time: "11:30am",
seats: 30,
active: true,
created_at: "2013-10-28 14:22:42",
updated_at: "2013-10-28 14:22:42">
}
What am I missing?
Upvotes: 0
Views: 201
Reputation: 494
Looking at your rake routes output, the path you need to use is
orientation_registrations_path(orientation)
That will generate the correct link. From rake routes output:
orientation_registrations GET /orientations/:orientation_id/registrations(.:format) registrations#index
Upvotes: 1
Reputation: 5292
You are missing s
my friend
<%= link_to "R", orientation_registrations_path %></li>
Upvotes: 0
Reputation: 25029
Check the name of your routes carefully!
In this case the route that matches the URL you want is:
orientation_registrations GET /orientations/:orientation_id/registrations(.:format) registrations#index
Note registrations
, not registration
!
Upvotes: 1