3 ms·
Yeah, the Rails community noticed this a while ago. Put the business logic doing transformations on models and interacting with external dependencies in service
by abvdasker 7y ago
Yeah, the Rails community noticed this a while ago. Put the business logic doing transformations on models and interacting with external dependencies in service classes, which accomplishes three things:
1) Avoids bloating model objects.
2) Avoids creating complicated controllers.
3) Makes it much easier to move to a microservices architecture when the time comes, because business logic has already been grouped into isolated components.
https://multithreaded.stitchfix.com/blog/2015/06/02/anatomy-of-service-objects-in-rails/ https://multithreaded.stitchfix.com/blog/2015/06/02/anatomy-...
https://www.toptal.com/ruby-on-rails/rails-service-objects-tutorial https://www.toptal.com/ruby-on-rails/rails-service-objects-t...