Tag route

4 votes

8044 views

Overuse route customizations

According to Roy Fielding’s doctoral thesis, we should use restful routes to represent the resource and its state. Use the default 9 actions without overusing route customizations.

implemented

Comments

by ihower
ihower

4 votes

12592 views

Needless deep nesting

Some people will define 3 or more level nested routes, it's a kind of over design and not recommended.

implemented

Comments

by ihower
ihower

9 votes

6979 views

Not use default route if you use RESTful design

If you use RESTful design, you should NOT use default route. It will cause a security problem. I explain at http://ihower.tw/blog/archives/3265 too.

implemented

Comments

by ihower
ihower

32 votes

21836 views

split route namespaces into different files

the routes will become complicated with the growth of your application, contain different namespaces, each with a lot of resources and custom routes, it would be better to split routes into different files according to the namespaces, which makes it easy to maintain the complicated routes.

Comments

flyerhzm

14 votes

22282 views

Restrict auto-generated routes.

By default, Rails generates seven RESTful routes(new,edit,create,destroy,index,show, update) for a resource, sometime the resource only needs one or two routes, so just user :only or :except while defining routes to speedup the routing.

implemented

Comments

by yorzi
yorzi