Skip to content

Commit

Permalink
revert_to now writes attributes via hash-style assignment instead of …
Browse files Browse the repository at this point in the history
…directly in order to prevent running a custom setter on a value twice.
  • Loading branch information
Brian Rose & Mike Barinek authored and technoweenie committed Oct 29, 2010
1 parent 28ba061 commit efc726d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_versioned.rb
Expand Up @@ -332,7 +332,7 @@ def altered?
# Clones a model. Used when saving a new version or reverting a model's version. # Clones a model. Used when saving a new version or reverting a model's version.
def clone_versioned_model(orig_model, new_model) def clone_versioned_model(orig_model, new_model)
self.class.versioned_columns.each do |col| self.class.versioned_columns.each do |col|
new_model.send("#{col.name}=", orig_model.send(col.name)) if orig_model.has_attribute?(col.name) new_model[col.name] = orig_model.send(col.name) if orig_model.has_attribute?(col.name)
end end


if orig_model.is_a?(self.class.versioned_class) if orig_model.is_a?(self.class.versioned_class)
Expand Down

0 comments on commit efc726d

Please sign in to comment.