I am trying to find all posts made by a user or his frnds…
So far i have this
Activity.any_of({"user_id" => 1}, {"for_id" => 1}, {"comments.user_id" => 1})
now, how do i add to these the condition that user_id can be by anyone who is a frnd of user… will doing this work?
Activity.any_of({"user_id" => 1}, {"for_id" => 1}, {"comments.user_id" => 1}).any_in("user_in" => [1,2])
Not sure how to do it in rails but the query you’re looking for is either :
Or a bit easier, combine your user id and your friend user ids into one list and do