I have an Article
which has_many :comments
, and Comment
belongs_to :article
and :user
. I was wondering what the most efficient Arel query would be to get the unique users who commented on a given article.
Thanks!
I have an Article
which has_many :comments
, and Comment
belongs_to :article
and :user
. I was wondering what the most efficient Arel query would be to get the unique users who commented on a given article.
Thanks!
This StackOverflow post seems to answer this question well: ruby on rails - How to fetch distinct values with arel/relational algebra and has_many :through - Stack Overflow