aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/acts_as_versioned.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/acts_as_versioned.rb b/lib/acts_as_versioned.rb
index 7aa72b2d6..46c072104 100644
--- a/lib/acts_as_versioned.rb
+++ b/lib/acts_as_versioned.rb
@@ -272,8 +272,8 @@ module ActiveRecord #:nodoc:
# Saves a version of the model in the versioned table. This is called in the after_save callback by default
def save_version
- if @is_new_record || save_version?
- @is_new_record = nil
+ if @saving_version
+ @saving_version = nil
rev = self.class.versioned_class.new
clone_versioned_model(self, rev)
rev.version = send(self.class.version_column)
@@ -386,7 +386,7 @@ module ActiveRecord #:nodoc:
protected
# sets the new version before saving, unless you're using optimistic locking. In that case, let it take care of the version.
def set_new_version
- @is_new_record = new_record?
+ @saving_version = new_record? || save_version?
self.send("#{self.class.version_column}=", next_version) if new_record? || (!locking_enabled? && save_version?)
end