def on_failure(object, *args)
      state = machine.states.match!(object)
      machine.invalidate(object, :state, :invalid_transition, [[:event, human_name(object.class)], [:state, state.human_name(object.class)]])

      transition = Transition.new(object, machine, name, state.name, state.name)
      transition.args = args if args.any?
      transition.run_callbacks(:before => false)
    end
def on_failure(object, *args)
      state = machine.states.match!(object)
      machine.invalidate(object, :state, :invalid_transition, [[:event, human_name(object.class)], [:state, state.human_name(object.class)]])

      transition = Transition.new(object, machine, name, state.name, state.name)
      transition.args = args if args.any?
      transition.run_callbacks(:before => false)
    end
Marks the object as invalid and runs any failure callbacks associated with
 this event.  This should get called anytime this event fails to transition.