Permalink
Browse files

Changed the identity_map test for belongs_to methods to look at the

target of the association instead of the association itself. The
association doesn't return the object you're looking for, it instead
returns a proxy object. Since this isn't actually an instance of the
class of the association, it will never be the same object as what
you're looking for. if you use #target, however, it gives you access
to the underlying object, which should be the same as one called
straight from the db.
  • Loading branch information...
1 parent ac22721 commit 438333cbbd5e1ca26a1e899a369e866cbac3c9a0 @pjdavis committed Mar 9, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 spec/identity_map_spec.rb
View
2 spec/identity_map_spec.rb
@@ -21,7 +21,7 @@
it "should work for belongs_to assocations" do
d1 = Customer.first
d2 = PhoneNumber.first.customer
- d1.__id__.should == d2.__id__
+ d1.__id__.should == d2.target.__id__
end
it "should work for creating objects" do

0 comments on commit 438333c

Please sign in to comment.