I am quite new to Rails. I will go stright to the point.
The models in question are: User
The “followeds” schema(or table) has “user_id” that is a reference to “users” table And it has “followed_id” that is an integer.
What I want to achieve:
Inside my controller I want to select all the users that have an id corresponding to followed_id
@users = User.all.where(something like => “user.id: followeds.followed_id”)
Basically comparing the id for users table (user.id) to followeds.followed_id integers and if they match extract the record of the user.
I hope I explained myself.
Thank you in advance for your help. It is much appreciated.