From 3ea4476942d2ba5ddc0d3b2d1f3730455661b06a Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 19 Jan 2016 17:27:21 +0100 Subject: 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. --- activerecord/lib/active_record/inheritance.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record/inheritance.rb') 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) -- cgit v1.2.3