module ThreeScale
  module StateMachine
    module Transitions
      def transition_to(state)
        return unless state && persisted?

        if path = state_paths(to: state).first
          path.each{ |transition| transition.perform }
        end
      end
    end
  end
end
