Hello I am using following query
Message.select("DISTINCT(commentable_id, user_id) as owner_id").map(&:owner_id)
It gives me the result like this: ["(8,9)", "(8,84)", "(9,8)", "(84,8)"]
here "(8, 9)" and "(9, 8)" are returns as different, but I want only single record. Means the result should be like
["(8,9)", "(8,84)"] So how can I achieve it.
Update
My table:
id | user_id | commentable_id
1 | 8 | 9
2 | 8 | 84
3 | 9 | 8
4 | 84 | 8
5 | 8 | 84
And I want result with id 1, 2. Actually this is conversation view so either I am a sender(user_id) or receiver(commentable_id). If I am a user with id 8 then in my conversation view I will have only two with id 9 and 84.
Thanks