Sorting by a field of an associated class

Max :

Actually to get this to work i had to change the value of :order to :order => 'companies.name', ie to match the name of the db table.

You can use :order => "#{Company.table_name}.name" to avoid thinking about the real (eventually legacy) name of the db table.

  -- Jean-François.