Home > Mobile >  Which tasks should go into the Controller classes? [closed]
Which tasks should go into the Controller classes? [closed]

Time:10-01

Some people say that one should put the heavy–lifting code into the Model classes, while keeping the Controllers slim.

Which tasks are appropriate to be put into controllers?

Can someone name one or two typical examples with explanation why?

CodePudding user response:

We should avoid writing the business logic into the controller like calculating the user's score on API calls. We should write the score calculating login in the user model and then call this method in our controller. Please check this blog to understand it better -> https://dev.to/kputra/rails-skinny-controller-skinny-model-5f2k

  • Related