Open elan opened 12 years ago
+1 from me, it's weird thing. In console it works great, but not in real application.
I think it's because of identifying objects in ruby\rails. User, which been called as User.find(1) has one object id, and the other user, from friendship.friendable is the other, so comparing them is meaningless.
I forked amistad, and fixed this bug by comparing User.id and friendable.id. But also, I think that using :inverse_of in relations can do the same.
The
invited_by?
andinvited?
methods aren't working for me because of this line:For some reason when I access a User instance via the association, even though I get something back which appears to be the same class, but isn't, iow (assuming the friendable ID is 1):
This is under Webrick, Rails 3.0.10, Amistad 0.8.
The most bizarre thing is that it works in the Rails console just fine, and it works in Webrick ONCE before failing.
I hesitated to post this because I am clearly insane, but it's also 100% reproducible.