Skip to content

Commit

Permalink
#save_version? is always false in after_save
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Jun 25, 2008
1 parent c7e812f commit 886d1a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/acts_as_versioned.rb
Expand Up @@ -272,8 +272,8 @@ def self.included(base) # :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)
Expand Down Expand Up @@ -386,7 +386,7 @@ def empty_callback() end #: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

Expand Down

0 comments on commit 886d1a0

Please sign in to comment.