Posts -------------------------------- | id | title | user_id | ------------------------------ | 1 | Say hello | 1 | -------------------------------- | 2 | Amazing world | 2 | -------------------------------- Users -------------- | id | name | -------------- | 1 | Alice | -------------- | 2 | Bob | -------------- Votes -------------------------------------- | id | user_id | post_id | vote_type | -------------------------------------- | 1 | 1 | 2 | 1 | -------------------------------------- current_user.id = 1 How to get all posts of all users and vote_type for post of current_user Need posts --------------------------------------------------------- | id | title | user_id | current_user_vote_type | --------------------------------------------------------- | 1 | Say hello | 1 | nil | --------------------------------------------------------- | 2 | Amazing world | 2 | 1 | ---------------------------------------------------------