title: ruby class with nested state machines using state_machine gem
body: <p>all
  I am trying to implement state machine on ActiveRecord object <a href="https://github.com/pluginaweek/state_machine" rel="nofollow">https://github.com/pluginaweek/state_machine</a> gem. But I would like to have nested state_machines. So far I have this simple state machine:</p>
  
  <pre><code>class Document &lt; ActiveRecord::Base
  
    state_machine :initial =&gt; :new do
      before_transition :new =&gt; :processing, :do =&gt; :start_processing
  
      event :start_processing do
        transition :new =&gt; :upload_to
      end
  
      event :finish_processing do
        transition :processing =&gt; :ok
      end
  
      event :error_in_processing do
        transition :processing =&gt; :error
      end
  
      event :to_trash do
        transition :processing =&gt; :trash
      end
    end
  </code></pre>
  
  <p>But what I would like to do, is to have nested state machine which would start after transition to processing state. This nested state machine would have states such as, uploading_to_xxx, extracting_from_yyy, pending, verifying and so on.
  I could probably implement this using just one state machine, but I would prefer to use nested state machines. I can not find any samples on web. Does state_machine support this use case? Or if there is  other gem could you point me to it?
  thanks</p>