I want to write a scope that returns the most recent (created_at) row for each person_id So this table id person_id created_at 1 111 2013-12-01 08:00 2 222 2013-11-20 07:00 3 111 2013-12-10 09:00 4 333 2013-10-21 08:00 5 333 2013-10-15 08:00 should return this 2 222 2013-11-20 07:00 3 111 2013-12-10 09:00 4 333 2013-10-21 08:00 Can someone help me out? Many thanks