A slightly exotic but I believe useful option, would be letting resources:
fetch parameters from the url match
dispatch to a custom controller (that does not correspond to the url)
The case these try to solve is pretty URLs for categories of a single resource.
Say in a shop website, having /chairs/:id, /tables/:id, /beds/:id all dispatch to a Product controller with a type parameter to distinguish between them.
I imagine something in the lines of:
router.resource(':type','Products')
which would be pretty easy to implement - just provide the first parameter instead of #{slug} and the second parameter instead of #{controller} in the routes generated by the constructor. The methods of the controller would then have params.type available as whatever was between the slashes.
there might be a better syntax to make these optional and whatnot..
A slightly exotic but I believe useful option, would be letting resources:
The case these try to solve is pretty URLs for categories of a single resource. Say in a shop website, having /chairs/:id, /tables/:id, /beds/:id all dispatch to a Product controller with a type parameter to distinguish between them.
I imagine something in the lines of:
router.resource(':type','Products')
which would be pretty easy to implement - just provide the first parameter instead of #{slug} and the second parameter instead of #{controller} in the routes generated by the constructor. The methods of the controller would then have params.type available as whatever was between the slashes.
there might be a better syntax to make these optional and whatnot..