From 70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 14 Nov 2014 10:45:53 -0700 Subject: Revert "Improve performance of AR object instantiation" This reverts commit 8fee923888192a658d8823b31e77ed0683dfd665. Conflicts: activerecord/lib/active_record/attribute_set/builder.rb This solution sucks, and is hard to actually apply across the board. Going to try other solutions --- activerecord/lib/active_record/inheritance.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (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 4aad3217cb..f58145ab05 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -165,19 +165,15 @@ module ActiveRecord # record instance. For single-table inheritance, we check the record # for a +type+ column and return the corresponding class. def discriminate_class_for_record(record) - discriminate_class_for_value(record[inheritance_column]) - end - - def discriminate_class_for_value(value) - if using_single_table_inheritance?(value) - find_sti_class(value) + if using_single_table_inheritance?(record) + find_sti_class(record[inheritance_column]) else super end end - def using_single_table_inheritance?(value) - value.present? && columns_hash.include?(inheritance_column) + def using_single_table_inheritance?(record) + record[inheritance_column].present? && columns_hash.include?(inheritance_column) end def find_sti_class(type_name) -- cgit v1.2.3