ActiveRecord - Paprikas/rails_cheat_sheet GitHub Wiki

Check duplicated records

User.select(:email).group(:email).having("count(*) > 1").size