Make ActiveRecordModel.(not_)in_state work with initial states

Annoyingly this means all implementations of  `ActiveRecordModel` need to add a `state_machine_class` class method, so that initial state can be detected.

@greysteil could you take an initial sanity-check? The SQL is getting pretty skanky now.