What is the best way to find records with duplicate values across multiple columns using Postgres, and Activerecord?
I found this solution here:
User.f
If you need the full models, try the following (based on @newUserNameHere's answer).
User.where(email: User.select(:email).group(:email).having("count(*) > 1").select(:email))
This will return the rows where the email address of the row is not unique.
I'm not aware of a way to do this over multiple attributes.