aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-01-13 15:04:23 +0100
committerYves Senn <yves.senn@gmail.com>2014-01-13 15:07:14 +0100
commite95031f55dd54945abebe6e9f8a12e428ada4146 (patch)
tree78980ad99b642e51df1b0fdeb366f53044ef1740 /activerecord/lib/active_record/persistence.rb
parentee4b5f1b8aedc59d94e72e1f0689de48e3b477bb (diff)
downloadrails-e95031f55dd54945abebe6e9f8a12e428ada4146.tar.gz
rails-e95031f55dd54945abebe6e9f8a12e428ada4146.tar.bz2
rails-e95031f55dd54945abebe6e9f8a12e428ada4146.zip
fix bug in becomes! when changing from base to subclass. Closes #13272.
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 4669c072a1..460fbdb3f8 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -196,7 +196,11 @@ module ActiveRecord
# share the same set of attributes.
def becomes!(klass)
became = becomes(klass)
- became.public_send("#{klass.inheritance_column}=", klass.sti_name) unless self.class.descends_from_active_record?
+ sti_type = nil
+ if !klass.descends_from_active_record?
+ sti_type = klass.sti_name
+ end
+ became.public_send("#{klass.inheritance_column}=", sti_type)
became
end