I tried to grab the latest N records with a unique value (first_name).
So far:
@users = User.all(:limit => 5, :sort => [:created_at, :desc]).distinct(:first_name)
almost works..But ignores the limit and sort order
Also:
@users = User.limit(5).desc(:created_at).distinct(:first_name)
Ignores both ‘limit’ and ‘desc’
@users = User.limit(5)
Works..
What am I doing wrong?
Any help would be greatly appreciated!
I played with this for a little while and this is the best I could come up with.
Good luck.