From 4abd20a49fe8038367595c9f0dfb35575fd2b195 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 30 Aug 2017 17:16:27 +0200 Subject: [PATCH] Fixed bug: Inconsistent data state for instance attribute on failed save! attempt. --- lib/sequencer/unit/import/common/model/save.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sequencer/unit/import/common/model/save.rb b/lib/sequencer/unit/import/common/model/save.rb index 8dec6b8ab..588009808 100644 --- a/lib/sequencer/unit/import/common/model/save.rb +++ b/lib/sequencer/unit/import/common/model/save.rb @@ -9,6 +9,7 @@ class Sequencer include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure uses :instance, :dry_run + provides :instance def process return if dry_run @@ -16,6 +17,9 @@ class Sequencer instance.save! rescue => e handle_failure(e) + + # unset instance if something went wrong + state.provide(:instance, nil) end end end