diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-08-19 21:48:19 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-08-19 16:03:15 -0500 |
commit | 0b73f2af0e08c21ff75199505804993160117452 (patch) | |
tree | 8bd3bbdadca962bb218fff634dbd9ca4adceb8f9 | |
parent | de0f47afb26703d6d4aefdeb7f76b8d3e0fe134d (diff) | |
download | rails-0b73f2af0e08c21ff75199505804993160117452.tar.gz rails-0b73f2af0e08c21ff75199505804993160117452.tar.bz2 rails-0b73f2af0e08c21ff75199505804993160117452.zip |
Optimize find_sti_class when store_full_sti_class is true
[#5403]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
-rw-r--r-- | 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 d9b4cd3831..90241dd897 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}'. " + |