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, :order =>
> 'last_activity_at DESC', :include => [:friendships => :friend])[/code]
>
> [code]<%= render :partial => 'friends_activity', :collection =>
> @activities.friendships %>[/code]
>
> But the descending ordering is not working :( What I am missing here?
> Cheers, Pete

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
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to