public
Description: ActiveRecord plugin for versioning your models.
Clone URL: git://github.com/technoweenie/acts_as_versioned.git
#save_version? is always false in after_save
technoweenie (author)
Wed Jun 25 02:41:43 -0700 2008
commit  886d1a0102378450b6ed4c28f9dd62c60d1bd671
tree    bce01e5d3571a95128872b3196309557db4557b4
parent  c7e812f2b94096558c442c0b399bc8ade346fede
...
272
273
274
275
276
 
 
277
278
279
...
386
387
388
389
 
390
391
392
...
272
273
274
 
 
275
276
277
278
279
...
386
387
388
 
389
390
391
392
0
@@ -272,8 +272,8 @@ module ActiveRecord #:nodoc:
0
 
0
         # Saves a version of the model in the versioned table. This is called in the after_save callback by default
0
         def save_version
0
- if @is_new_record || save_version?
0
- @is_new_record = nil
0
+ if @saving_version
0
+ @saving_version = nil
0
             rev = self.class.versioned_class.new
0
             clone_versioned_model(self, rev)
0
             rev.version = send(self.class.version_column)
0
@@ -386,7 +386,7 @@ module ActiveRecord #:nodoc:
0
         protected
0
           # sets the new version before saving, unless you're using optimistic locking. In that case, let it take care of the version.
0
           def set_new_version
0
- @is_new_record = new_record?
0
+ @saving_version = new_record? || save_version?
0
             self.send("#{self.class.version_column}=", next_version) if new_record? || (!locking_enabled? && save_version?)
0
           end
0
 

Comments

    No one has commented yet.