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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
