我需要为 Rails 3 中的资源实现一些对 SEO 友好的排序方法。这是我正在考虑为集合做的事情:
/things # shows all things
/things/popular # shows all things ordered by popularity
/things/a-z # shows all things ordered alphabetically
这对于单个记录:
/thing/name-of-a-thing # shows ONE thing
单数/复数之间的切换是为了避免事物名称与排序方法名称冲突。
到目前为止,我一直在使用resource :things
which uses /things
for all actions。我很担心要摆脱默认设置,因为我知道在设置这些默认设置方面已经考虑了很多。所以在我这样做之前,我想我会寻求一些建议,以防这种事情有最佳实践。
那么,这是解决我问题的好方法吗?我是否对未来的任何问题敞开心扉?有没有更好的方法来解决这个问题?
谢谢!