Bugs in eager loading of has_one :through and has_many :through

Failing test can be found here:
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1723-eager-load-of-has_one-through-with-conditions-on-the-through-table-fails

Eager loading of has_one :through has an easy to fix problem. It
doesn't pass the :conditions or :order of the base association down to
the "source" include on the :through association. has_many :through
does this already, the "options" just need to be passed down.

The larger problem, of both has_one :through and has_many :through is
when you have a :conditions that references the :through table. Since
preload never does any joining, it always does the associations
independently, it throws a SQL error because it can't find that table.

This is only a problem with eager loading, the find_every code in
base.rb does the correct detection normally.

Failing test can be found here:
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1723-eager-load-of-has_one-through-with-conditions-on-the-through-table-fails

Eager loading of has_one :through has an easy to fix problem. It
doesn't pass the :conditions or :order of the base association down to
the "source" include on the :through association. has_many :through
does this already, the "options" just need to be passed down.

The larger problem, of both has_one :through and has_many :through is
when you have a :conditions that references the :through table. Since
preload never does any joining, it always does the associations
independently, it throws a SQL error because it can't find that table.

I've been vaguely meaning to rewrite the preload code so that it loads
hmt associations in one go (rather than loading the records in two
steps).
There's a preliminary task which is to refactor the hmt code to make
it easy for the preload stuff to recreate the appropriate joins (don't
really fancy duplicating all that like in join based eager loading).

Fred