我与一个条件关联,该条件指的是与直接加载的对象不同的对象:
it "should point to the same object" do
user = create(:user)
user.current_location.should == nil
user.update_location(latitude: 11, longitude: 22)
user.current_location.should_not == nil
location = UserLocation.first
location.id.should == user.current_location.id
location.object_id.should == user.current_location.object_id #fails on this line
end
在我看来,关联和直接加载的对象都应该指向同一个对象。这是预期的行为吗?
这是我的模型的重要部分的要点: https ://gist.github.com/2635673