aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2016-01-19 17:27:21 +0100
committerYves Senn <yves.senn@gmail.com>2016-01-19 17:31:16 +0100
commit3ea4476942d2ba5ddc0d3b2d1f3730455661b06a (patch)
tree4338c44719004fbd15a59783008de68b11321c20 /activerecord/lib/active_record/inheritance.rb
parentf8234313feab83c65912b2d96a6dd8e0149b8642 (diff)
downloadrails-3ea4476942d2ba5ddc0d3b2d1f3730455661b06a.tar.gz
rails-3ea4476942d2ba5ddc0d3b2d1f3730455661b06a.tar.bz2
rails-3ea4476942d2ba5ddc0d3b2d1f3730455661b06a.zip
run `type` column through attribtues API type casting.
Closes #21986. This makes it possible to write custom types that define a different mapping for STI columns.
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index 6259c4cd33..3a17f74b1d 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -167,6 +167,7 @@ module ActiveRecord
end
def find_sti_class(type_name)
+ type_name = base_class.type_for_attribute(inheritance_column).cast(type_name)
subclass = begin
if store_full_sti_class
ActiveSupport::Dependencies.constantize(type_name)