aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-11-14 10:45:53 -0700
committerSean Griffin <sean@thoughtbot.com>2014-11-14 14:30:39 -0700
commit70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1 (patch)
tree1f74f87d45b6f539f8378a44652a9571bb47bfd0 /activerecord/lib/active_record/inheritance.rb
parent114e9f2bdf9327ebadb1fc72400c1ef80c3f6c3b (diff)
downloadrails-70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1.tar.gz
rails-70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1.tar.bz2
rails-70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1.zip
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
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb12
1 files changed, 4 insertions, 8 deletions
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)