1

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!

Marcus
  • 11
  • 2

1 Answers1

0

You need define all route by match.

match '/things' => 'Things#index'
match '/things/:order' => 'Things#index'
match '/thing/:id' => 'Things#show'

and kill your resources, route or use it after all match route define.

shingara
  • 46,608
  • 11
  • 99
  • 105
  • Thanks but that wasn't the question. I understand how to implement this. I am asking if it's a good URL design and/or what alternatives/best-practices there are for this problem. – Marcus Nov 03 '10 at 07:50