Summary
In this chapter, you learned about the Ruby on Rails trade-offs introduced by such design patterns as callbacks, Rails concerns, and Current
attributes. You learned about different types of callbacks used in Rails controllers and models and how to assess their effect on maintainability. You got familiar with event-driven architecture and how it can be used to untangle models’ responsibilities.
You learned how Rails concerns differ from Ruby modules and how they can be used to extract behaviors from models. You learned the limitations of splitting classes into models and how extracting domain objects can be used as an alternative approach to refactoring models. You also learned about the downsides of having global state and how to minimize them.
In the next chapter, we will take the first step toward new abstraction layers by introducing service objects.