aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-06-11 07:04:32 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-06-11 07:04:32 -0600
commit75761c17380f9129e08dd04954ae162c5cdcea6e (patch)
tree0aaf28e5518c7c1b6c864b1f088e359bcbceb063 /activerecord/lib
parent90d0b852a54bdd2cedb8304981f6c7a3d8c7a8d3 (diff)
parenta3bab772a86414b7c854995d36b0ab0bb12fd50a (diff)
downloadrails-75761c17380f9129e08dd04954ae162c5cdcea6e.tar.gz
rails-75761c17380f9129e08dd04954ae162c5cdcea6e.tar.bz2
rails-75761c17380f9129e08dd04954ae162c5cdcea6e.zip
Merge pull request #20497 from dcrec1/master
refactor ActiveRecord's #become by removing not needed code
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/persistence.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 437ba31711..0a6e4ac0bd 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -211,8 +211,7 @@ module ActiveRecord
def becomes(klass)
became = klass.new
became.instance_variable_set("@attributes", @attributes)
- changed_attributes = @changed_attributes if defined?(@changed_attributes)
- became.instance_variable_set("@changed_attributes", changed_attributes || {})
+ became.instance_variable_set("@changed_attributes", attributes_changed_by_setter)
became.instance_variable_set("@new_record", new_record?)
became.instance_variable_set("@destroyed", destroyed?)
became.instance_variable_set("@errors", errors)