I need to implement some SEO-friendly sort methods for a resource in Rails 3. This is what I'm considering doing for collections:
/things # shows all things
/things/popular # shows all things ordered by popularity
/things/a-z # shows all things ordered alphabetically
And this for single records:
/thing/name-of-a-thing # shows ONE thing
The switching between singular/plural is to avoid thing-names colliding with sort-method-names.
Until now I have been using resource :things which uses /things for all actions. I'm apprehensive to break away from the defaults since I know a lot of thought has gone into making those defaults. So before I do, I thought I'd seek some advice in case there's a best practice for this kind of thing.
So, is this a good way to solve my problem? Am I opening myself up to any problems down the road? Are there better ways to go about this?
Thanks!
You need define all route by match.
and kill your resources, route or use it after all match route define.