In the rail, is it ok to define logic in the controller with a model, for example, take a user model is , Which is good design.
1) Exclude Usel Mödel with CRUED model and transfer another controller to all other user special actions or 2) Add user-specific tasks to a single usermodel
Thanks :)
I like the following approach
create a different user model In business like a different namespace (to represent business login) and all in it Business will be logic and will be a separate user model which will be received from ActiveRecord
Example
class business :: user
# All these users will become business logic
# You may need a user (ORM) model when it is necessary to search for the operation
end
and my controller business: Will communicate with the user and for this class database actions the user (ORM) class Will communicate with
class user & lt; ActiveRecord :: Base
Termination
In this way you can separate your business login and ORM.
Cheers, Equality
Comments
Post a Comment