Permalink
Browse files

Revert "Merge pull request #4746 from jenslukowski/issue4718"

This reverts commit 5cad7a0, reversing
changes made to bb842e8.
  • Loading branch information...
1 parent 75de1ce commit c4469e6c39f68eee97d6cc21412b685eaeb59dce @tenderlove tenderlove committed Jan 31, 2012
View
9 activerecord/lib/active_record/relation/finder_methods.rb
@@ -318,8 +318,7 @@ def find_with_ids(*ids)
def find_one(id)
id = id.id if ActiveRecord::Base === id
- if IdentityMap.enabled? &&
- (where_values.blank? || contains_only_subclass_constraint?(where_values)) &&
+ if IdentityMap.enabled? && where_values.blank? &&
limit_value.blank? && order_values.blank? &&
includes_values.blank? && preload_values.blank? &&
readonly_value.nil? && joins_values.blank? &&
@@ -395,11 +394,5 @@ def find_last
def using_limitable_reflections?(reflections)
reflections.none? { |r| r.collection? }
end
-
- def contains_only_subclass_constraint?(where_values)
- where_values.length == 1 &&
- !where_values[0].left.nil? && where_values[0].left.relation.name == table_name &&
- !where_values[0].right.nil? && where_values[0].right.length == 1 && where_values[0].right[0] == @klass.name
- end
end
end
View
8 activerecord/test/cases/identity_map_test.rb
@@ -162,14 +162,6 @@ def test_inherited_with_type_attribute
c2 = Comment.find(c.id)
assert_same(c1, c2)
end
-
- def test_queries_are_not_executed_when_finding_inherited_class_by_id
- c = comments(:sub_special_comment)
- SubSpecialComment.find(c.id)
- assert_no_queries do
- SubSpecialComment.find(c.id)
- end
- end
##############################################################################
# Tests checking dirty attribute behavior with IM #

0 comments on commit c4469e6

Please sign in to comment.