Event Sourcing: A Rails Case Study

If you’re building a Rails app in a complex domain that is changing as quickly as your company iterates, one of the most frustrating problems can be understanding how an incorrect record got into its current state. The interactions are complicated, concerns may have changed in the middle of that record’s lifespan, and the code that set its current values might not exist any more.

Event Sourcing, a pattern defined by Martin Fowler, offers one way out of this: Storing all changes as time-based, replayable events and then calculating the record’s state by rerunning the history.

In this talk, Francis Hwang covers the nuts and bolts of that implementation using nothing more than plain old Rails and Postgres, and walks through the design implementations of this idea.

40:35

And Francis did make that gem. Check out the repo here.
This event was recorded at the NYC.rb meetup at Pivotal.