Created
November 10, 2013 11:53
-
-
Save 0xGGGGG/7397304 to your computer and use it in GitHub Desktop.
arel duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User | |
.where( | |
phone: User | |
.select('phone, count(phone)') | |
.group('phone') | |
.having('count(phone) > 1') | |
.select{|u| u.phone.present?} | |
.map(&:phone) ) | |
.select([:id, :phone, :email, :fullname]) | |
.includes(:items) | |
.order(:phone) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment