A very simple problem feeling should not be affected very much, but it has obsessive-compulsive disorder, not to ask uncomfortable skinner .... For example, a page of the form, there are additions, edits, deletions and other functions, in the controller is to write three corresponding fucntion, or in a method, the act and other logical judgments to distinguish it?
Feel like there is not much difference, but still want to ask what kind of practice better, standardize some
Reply content:
A very simple problem feeling should not be affected very much, but it has obsessive-compulsive disorder, not to ask uncomfortable skinner .... For example, a page of the form, there are additions, edits, deletions and other functions, in the controller is to write three corresponding fucntion, or in a method, the act and other logical judgments to distinguish it?
Feel like there is not much difference, but still want to ask what kind of practice better, standardize some
It's usually three action.
Some special cases will be met add and edit share an action, delete individual one.
The assumption is that the model layer is written to determine how the data is processed (in fact, it is a compatible addition and editing method (; ´ρ ')).
Write separately, for reasons
If you write unit tests, it's good to test them separately.
RBAC makes it easy to set permissions.
Write three actions, regulate restful, and correspond to different request methods, such as Get,post,delete,put