I am having trouble returning all profiles that have blocked you with the amistad gem.
I am able to find profiles you have blocked.
And the profiles other individual profiles have blocked.
a = Profile.find_by_id 6
b = Profile.find_by_id 7
b.block_profile a
a.blockades
Profile Load (0.2ms) SELECT ".."
=> #<ActiveRecord::Associations::CollectionProxy [#<Profile id: 18....>]>
a.blockades_by
Profile Load (0.2ms) SELECT "profiles".* FROM "profiles" INNER JOIN "friendships" ON "profiles"."id" = "friendships"."friendable_id" WHERE "friendships"."blocker_id" = ? AND (friendable_id <> blocker_id) [["blocker_id", 6]]
=> #<ActiveRecord::Associations::CollectionProxy []>
b.blockades
Profile Load (0.2ms) SELECT "...."
=> #<ActiveRecord::Associations::CollectionProxy [#<Profile id: 6,....>]>
Oky, so it works if you know which profile exactly to look at.
But the issue is I would need to iterate through every profile and look at their blockades_by to see if the logged in user is there, then remove them from the final query. This is way too crazy. There needs to be a simpler way?