troessner/transitions — pull request #103 by ahorner (2013-10-03 23:06:35+00:00)
Title: Ignore `set_initial_state` after state is persisted

The existing behavior will always invoke the :enter callback for the
record's current state, regardless of whether or not that state was
previously set.

This is particularly bad for persisted records, as loading the record
from the database triggers the `set_initial_state` call, and will force
the :enter callback to be repeated -- this behavior is problematic when
the callback is anything complex or non-idempotent, such as triggering
an email.

The solution introduced here is to avoid invoking the :enter callback
unless `set_initial_state` actually assigns a new state.