I'm have this problem right now with my routes:
Route.resources('customers', 'CustomerController').except('create', 'edit')
.addCollection('names', 'GET', 'CustomerController.names')
All the urls in the resource work as expected except the collection 'names' which throws an Exception about not finding the id = names in the Customer model and that is because is CustomerController.show is the one trying to process it instead of the one I defined which is CustomerController.names.
I found solution by creating a url before the resource like this:
Route.get('customers/names', 'CustomerController.names')
Route.resources('customers', 'CustomerController').except('create', 'edit')
For now you can call addCollection before except, i'll add a fix to make sure collections and members have more priority over resourceful default routes
Hi!
I stumbled on this problem too.
This:
Route.resource('tracks', 'TrackController').addCollection('popular')
Is routing to TrackController.show
The suggestion of juanyunis works for now. Looking forward to the fix, way cleaner to use addCollection 馃憤
+1
Removed addCollection and addMember in 4.0, since they are confusing and adds very little value. So it's better to keep routes easy to scan with eyes, over doing magical stuff
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
For now you can call
addCollectionbeforeexcept, i'll add a fix to make sure collections and members have more priority over resourceful default routes