Q:

How can I modify this SQL find-duplicate-records statement to return ActiveRecord objects?

Per my verbose question, how can I modify this SQL statement to return an array of AR objects?
"SELECT id, user_id, activity_type_id, source_id, source_type, 
                COUNT(*) AS cnt
                FROM activities
                GROUP BY id, user_id, activity_type_id, source_id, source_type
                HAVING COUNT(*) > 1"
I'm using Rails 2.3.

A:

I saw you ask another question which looks related... are you trying to remove duplicate activities?  Why not just prevent their creation in the first place with a unique index on the table and a validates uniqueness of on the activity model.

