You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The invited_by? and invited? methods aren't working for me because of this line:
friendship.friendable == user
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):
User.find(1) == friendship.friendable # false!
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: