I am looking at booksindex for an example of nested routes. I see where the nesting is declared in the routes file. But the path names don't seem to reflect nesting. (Though they obviously work.)
As close as I understand, without any special configuration, the route parameter on the for index.html.erb in the index_entries view folder, would be, for example, <td><%= link_to 'Show', book_index_entry_url(@book, index_entry) %></td>. With @book providing the book ID, and index_entry providing the index_entry id.
Is that correct?
I know there are shortcuts to reduce the name parameter, but in order to understand it, I am trying to figure out what the actual syntax should be for route parameters.
Is it possible to see a version with routes fully flushed out, in a non-shortcut way, just to get the flavor of the correct syntax?
-- Let me see the book associated with this index entry:
<%= link_to 'Book for this index entry', book_path(@index_entry.book) %> |
(put in views/index_entries/show.html.erb
-- Or, let me see the index entries for this book:
<%= link_to 'Index entries for this book', book_index_entries_url(@book) %> |
(put in views/books/show.html.erb