You can use distinct as you mentioned or ''group by'' works too.
--
Thiago Jackiw
http://www.railsfreaks.com
On May 5, 12:15 pm, jg <jgagn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m trying to do something that seems easy but I can''t
figure it out.
> I have Post.find(:all, :order => "created_at desc", :limit
=> 10)
> but if a user has a bunch of posts, I only want one of them to show up
> in the results so I have 10 posts with 10 unique user_ids. I feel like
> distinct comes into play here somewhere.
>
> Anyone have any thoughts on this?
>
> thanks
>
> J
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---