> I'd write the above query like this:
> u = User.find_by_username ...
> u.friendships.find :all, :joins => :friends, :order =>
> 'last_activity_at desc'
Cheers Fred, this is the trick I was looking for.
Petr
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~--
On Dec 1, 9:47 am, Petr Bobek <[EMAIL PROTECTED]>
wrote:
> > That sort would have ordered the users (from the 'main' find) by
> > descending last_activity_at, not the associations (which are loaded
> > with a separate find)
>
> > Fred
>
> Ohh I see, I was trying to sort friendships table, but th
> That sort would have ordered the users (from the 'main' find) by
> descending last_activity_at, not the associations (which are loaded
> with a separate find)
>
> Fred
Ohh I see, I was trying to sort friendships table, but there is no
column last_activity_at. I guess that's it. :( or is there
On 1 Dec 2008, at 08:48, Petr Bobek wrote:
>
> Hi,
>
> I have user table (last_activity, last_activity_at, ) and
> friendships table (many to many).
> What I am trying to do is to show to the user the last actions of
> his/her friends.
>
> [EMAIL PROTECTED] = User.find_by_username(username,
4 matches
Mail list logo