title: Unable to transition from new state - pending refund details state Rails Statemachine Gem --- Pluginaweek
body: <p>Can't understand via I am getting this error StateMachine::InvalidTransition: Cannot transition state via :refund_details_not_found from :new (Reason(s): State cannot transition via "refund details not found")</p>
  
  <pre><code>state_machine :initial =&gt; :new do    
      event :all_products_received do
        transition [:new, :pending_refund_details, :canceled] =&gt; :pending_payment
      end
  
  event :refund_details_not_found do
    transition :new =&gt; :pending_refund_details
  end
  
  event :order_return_canceled do
    transition :new =&gt; :canceled
  end
  
  event :mistaked_canceled do
    transition :canceled =&gt; :buyer_dispatched
  end
  
  event :payment_made do
    transition :pending_payment =&gt; :payment_complete
  end
  
  before_transition :to =&gt; :canceled do |return1|
    return1.total = 0
  end
  
  before_transition :to =&gt; :pending_payment do |return1|
    return1.pending_on = Time.now
  end
  
  before_transition :to =&gt; :payment_complete do |return1|
    return1.completed_on = Time.now
  end
  
  end
  </code></pre>
  
  <p>I calling the transition in before save</p>