Multiple joins to the same table/association with different conditions

I’m looking for a nice(!) way to specify multiple joins to the same
table where there are different conditions on each one.

I was hoping for something like this

class Model < ActiveRecord::Base
has_many :things

scope :some_things,
  joins(:things).where('' => 'bar').
  joins(:things => :others).where('' => 'baz')


Unfortunately, this is wishful thinking. As far as I can tell, I have to
write the SQL for the second join explicitly like this

 joins('JOIN things AS others ON = things.model_id')

Did I miss a better way?


Michael S.
mailto:[email protected]