mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
refactor ActiveRecord's #become by simplifying code
This commit is contained in:
parent
1a82e20f08
commit
a3bab772a8
1 changed files with 1 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue