Prevent collisions in Active Record

We (@yokolet and I) changed the #write_attribute method to `#write_model_attribute` to prevent a collision with ActiveRecord.

Also added convenience methods `#state.name?`. For example, a `:processing state` would generate
a `processing?` method. Specs were added around generation of this method.