What is the convention for ordering the controller actions in Rails?
Given a controller which implements all the CRUD actions: new
, create
, delete
, edit
, i开发者_StackOverflowndex
show
, update
, and also a few custom actions, is there any conventional (official or not) order these action should adhere to?
The "official" order (as generated by the rails scaffold) is the following
index
show
new
edit
create
update
destroy
Although I always do index
show
new
create
edit
update
destroy
because I think it's a tad more logical to have the actual action that does the work, like create
and update
after the new
and edit
actions.
精彩评论