Nested Routes Show Action: What objects does it expect?
- by NoahClark
Here is the relevant line from my rake routes:
client_note GET /clients/:client_id/notes/:id(.:format) notes#show
When I try passing in the objects like <%= client_note_path([client, @notes.first]) %>> I get:
No route matches {:action=>"show", :controller=>"notes",
:client_id=>[#<Client id: 5, ... , #<Note id: 9, ...]}
Which made me think to try a client ID. So, I tried: <%= client_note_path([client.id, @notes.first]) %>
which gives me:
No route matches {:action=>"show", :controller=>"notes", :client_id=>[5,
#<Note id: 9,content: "He just bought a brand new bobcat, be sure to charg...",
client_id: 5, created_at: "2012-06-11 16:18:16",
updated_at: "2012-06-11 16:18:16">]}
Which, made me want to try just passing in a client ID. <%= client_note_path(client.id) %>
No route matches {:action=>"show", :controller=>"notes", :client_id=>5}
Still not what I'm looking for. I want to be able to show an individual note which can normally be found at a url like looks like: http://localhost:3000/clients/2/notes/3/