:include and sorting

I added an include to a find statement in order to preload data rather than using lazy loading eg.Client.find(params[:id],:include=>[:contacts, :etc,:etc])

I have a sort clause in the Client model eg has_many :contacts, :order=>"contact_date"

The sort works fine when listing Client.contacts in a view, but as soon as I do the include to preload the sort order is lost.

Is there any simple way around this apart from removing the include?

Cheers George

giorgio wrote:

I added an include to a find statement in order to preload data rather than using lazy loading eg.Client.find(params[:id],:include=>[:contacts, :etc,:etc])

I have a sort clause in the Client model eg has_many :contacts, :order=>"contact_date"

The sort works fine when listing Client.contacts in a view, but as soon as I do the include to preload the sort order is lost.

Is there any simple way around this apart from removing the include?

   Client.find params[:id], :include=>[:contacts, :etc, :etc],                             :order => 'contacts.contact_date'

should work.