So this is more of an arel question than anything but here\'s what I am trying to do.
I have three objects lets say, called Items
-
I can't comment on posts yet, so, putting this as another answer for the question.
In case of someone still searches for this, @BananaNeil's answer is correct. However, putting distinct
in select
didn't work for me (Rails 5.2.2). Separating these two did fix my problem.
klass.where(
# Your query or whatever
).distinct.select('on (attribute) *')