Skip to content

Instantly share code, notes, and snippets.

View karandocs's full-sized avatar
🎮

Karan karandocs

🎮
View GitHub Profile
@rob-murray
rob-murray / find_dups.rb
Last active November 8, 2024 09:21
Rails find duplicate records
columns_that_make_record_distinct = [:some_id, :another_name]
duplicate_records = Model.where.not(id: Model.select("MIN(id) as id").group(columns_that_make_record_distinct))