Permalink
Browse files

Revert the merge because tests did not pass.

Revert "Merge pull request #423 from richardiux/master"

This reverts commit b8f08c4, reversing
changes made to fd9df1b.
  • Loading branch information...
1 parent b8f08c4 commit 886818d2bab40585c0cea763002ffc16917dd0b3 @josevalim josevalim committed May 6, 2011
@@ -830,10 +830,6 @@ def symbolized_base_class
@symbolized_base_class ||= base_class.to_s.to_sym
end
- def symbolized_sti_name
- @symbolized_sti_name ||= sti_name ? sti_name.to_sym : symbolized_base_class
- end
-
# Returns the base AR subclass that this class descends from. If A
# extends AR::Base, A.base_class will return A. If B descends from A
# through some arbitrarily deep hierarchy, B.base_class will return A.
@@ -49,7 +49,7 @@ def without
end
def get(klass, primary_key)
- record = repository[klass.symbolized_sti_name][primary_key]
+ record = repository[klass.symbolized_base_class][primary_key]
if record.is_a?(klass)
ActiveSupport::Notifications.instrument("identity.active_record",
@@ -64,15 +64,15 @@ def get(klass, primary_key)
end
def add(record)
- repository[record.class.symbolized_sti_name][record.id] = record
+ repository[record.class.symbolized_base_class][record.id] = record
end
def remove(record)
- repository[record.class.symbolized_sti_name].delete(record.id)
+ repository[record.class.symbolized_base_class].delete(record.id)
end
- def remove_by_id(symbolized_sti_name, id)
- repository[symbolized_sti_name].delete(id)
+ def remove_by_id(symbolized_base_class, id)
+ repository[symbolized_base_class].delete(id)
end
def clear
@@ -129,41 +129,6 @@ def test_creation
end
##############################################################################
- # Tests checking if IM is functioning properly on classes with multiple #
- # types of inheritance #
- ##############################################################################
-
- def test_inherited_without_type_attribute_without_identity_map
- ActiveRecord::IdentityMap.without do
- p1 = DestructivePirate.create!(:catchphrase => "I'm not a regular Pirate")
- p2 = Pirate.find(p1.id)
- assert_not_same(p1, p2)
- end
- end
-
- def test_inherited_with_type_attribute_without_identity_map
- ActiveRecord::IdentityMap.without do
- c = comments(:sub_special_comment)
- c1 = SubSpecialComment.find(c.id)
- c2 = Comment.find(c.id)
- assert_same(c1.class, c2.class)
- end
- end
-
- def test_inherited_without_type_attribute
- p1 = DestructivePirate.create!(:catchphrase => "I'm not a regular Pirate")
- p2 = Pirate.find(p1.id)
- assert_not_same(p1, p2)
- end
-
- def test_inherited_with_type_attribute
- c = comments(:sub_special_comment)
- c1 = SubSpecialComment.find(c.id)
- c2 = Comment.find(c.id)
- assert_same(c1, c2)
- end
-
- ##############################################################################
# Tests checking dirty attribute behaviour with IM #
##############################################################################

0 comments on commit 886818d

Please sign in to comment.