Permalink
Browse files

setting `changed_attributes` instance variable if it is already initi…

…alized.
  • Loading branch information...
1 parent c60eddd commit e8253d3a642d396d9646d082f97eb233a2b2396e @kuldeepaggarwal kuldeepaggarwal committed Dec 28, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/persistence.rb
@@ -181,7 +181,7 @@ def becomes(klass)
became = klass.new
became.instance_variable_set("@attributes", @attributes)
became.instance_variable_set("@attributes_cache", @attributes_cache)
- became.instance_variable_set("@changed_attributes", @changed_attributes)
+ became.instance_variable_set("@changed_attributes", @changed_attributes) if defined?(@changed_attributes)
became.instance_variable_set("@new_record", new_record?)
became.instance_variable_set("@destroyed", destroyed?)
became.instance_variable_set("@errors", errors)

0 comments on commit e8253d3

Please sign in to comment.