From cf3291e45f5cab75c4c77fb0da8e448f441a05b7 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 19 Aug 2010 21:48:19 +0100 Subject: [PATCH] Optimize find_sti_class when store_full_sti_class is true --- activerecord/lib/active_record/base.rb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d9b4cd3..90241dd 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -918,7 +918,11 @@ module ActiveRecord #:nodoc: self else begin - compute_type(type_name) + if store_full_sti_class + ActiveSupport::Dependencies.constantize(type_name) + else + compute_type(type_name) + end rescue NameError raise SubclassNotFound, "The single-table inheritance mechanism failed to locate the subclass: '#{type_name}'. " + -- 1.7.1