Sorry, I just don't know how to do it.

You'de better ask on rubyonrails-talk / googlegroups.com

Abinoam Jr.

On Tue, Dec 3, 2013 at 11:02 PM, Bo Pritchard <lists / ruby-forum.com> wrote:
> 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
>
> --
> Posted via http://www.ruby-forum.com/.