I want to find a ordered list of runners by their results.
models
class Race < ActiveRecord::Base
has_many :runners, :dependent => :destroy
end
class Runner < ActiveRecord::Base
belongs_to :race
has_one :result, :dependent => :destroy
end
class Result < ActiveRecord::Base
belongs_to :runner
end
trying to use something like this
ordered_runners = race.runners.all(:include => :result, :order => 'results.position ASC')
position is their finishing position ie [1,2,3,4....]
but if a result is missing (nil) then the runner is not included. Is there a way to do this and return all runners?
cheers