December 2025
Intermediate to advanced
452 pages
9h 7m
English
In this chapter, we’ll look at Rails models from a different angle, not from the persistence perspective but from the application state modeling point of view. More precisely, we will discuss the problem of describing state transitions and maintaining control over them. First, we will explore how state machines naturally emerge in Rails applications and how the same name abstraction can be used to keep the code base maintainable. Then, we will discuss the concept of a workflow, a specialized kind of state machine that represents a business process. Finally, we will consider some trade-offs of overusing state machines in code.
We will cover the following topics:
Read now
Unlock full access