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: http://stackoverflow.com/questions/5125209/how-to-fetch-distinct-values-with-arel-relational-algebra-and-has-many-through