aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrick <technoweenie@gmail.com>2008-06-25 02:41:43 -0700
committerrick <technoweenie@gmail.com>2008-06-25 02:41:43 -0700
commit886d1a0102378450b6ed4c28f9dd62c60d1bd671 (patch)
treebce01e5d3571a95128872b3196309557db4557b4
parentc7e812f2b94096558c442c0b399bc8ade346fede (diff)
#save_version? is always false in after_save
-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