README.md in rails_state_machine-2.1.1 vs README.md in rails_state_machine-2.2.0

- old
+ new

@@ -105,25 +105,36 @@ ## Other state attributes and multiple state machines on the same model To use a state attribute other than the default `state`, pass it to the `.state_machine` method: -``` +```ruby state_machine :review_state do # ... end ``` This also allows you to define multiple state machines on the same model. Note that event and state names still have to be unique for the whole model. +If you define multiple state machines on the same model, and use state names more than once, +you must use a prefix to avoid name collisions. +A prefix may be specified by passing the `:prefix` option when declaring your state machine: + +```ruby +state_machine :review_state, prefix: 'some_prefix' do + # ... +end +``` + + ## Taking multiple transitions You can safely take a second transition inside an after_save callback. All relevant callbacks will be run. -``` +```ruby state_machine do state :draft, initial: true state :review_pending state :approved