my model is
class Job < ActiveRecord::Base
belongs_to :client
end
class Client < ActiveRecord::Base
has_many :jobs
end
in controller i want get client with sorted jobs.
If i do (without ordering)
@client = Client.find(params[:id], :include => {:jobs => :status})
It is all ok. But if i add ordering:
@client = Client.find(params[:id], :include => {:jobs => :status}, :order => 'job.level DESC')
// :order is dynamicly set (not in this example) – i know about :order in has_many.
the result is only 3 rows (for every job.level one). I logged the sql query and executed it and result is ok, but in app i have only these 3 rows.
What is the right way to sort jobs? Thank you
This is not what i originally wanted, but it works, so this is answer