8 ms·
Agreed. Nested routing is fine, as long as it doesn't become redundant. Do: /artist/8/albums /albums/9 Don't: /artist/8/albums/9 Using query filters versu
by hawleyal 12y ago
Agreed. Nested routing is fine, as long as it doesn't become redundant.
Do:
/artist/8/albums
/albums/9
Don't:
/artist/8/albums/9
Using query filters versus nesting are virtually synonyms. I would say there is a minor semantic distinction in that the first one is a definite relationship, and the second one is a possible relationship. That is, "get the albums for artist 8" versus "get the albums searching for artist 8". The search could include other parameters as well, making it not as definite.
/artist/8/albums
/albums?artist=8
- shangxiao 12y agoChances are you're (well at least with me) going to do filtering anyway so /artist/8/albums becomes redundant ;)
- hawleyal 12y agoI see what you're saying, but it's not redundant, it's just a synonym. By redundant I meant that there are keys that are not necessary. /artist/{artist}/albums /albums?artist={artist} AlbumsController#index(artist)