Paranoid state machine
In one of our ruby project, we are using AASM gem. This gem lets you build a finite state machine for Ruby objects. We usually use it with ActiveRecord to persist the “state” of an object. This gem also provides simple API methods to switch the states of the object.