Is it possible to do eager loading of association extensions?
That is, the following code produces one SQL query:
cat = ProductCategory.find(:first, :include => :pricing_rules) cat.pricing_rules
But if in ProductCategory I have an association extension like this:
has_many :pricing_rules do
cat = ProductCategory.find(:first, :include => :pricing_rules) cat.pricing_rules.applicable
will produce 2 queries anyway, :include is useless here.
I see no other way that to add another association:
has_many :applicable_pricing_rules :conditions => ‘appliccable is true’
and then use it:
cat = ProductCategory.find(:first, :include =>
But maybe there’s a way to eagerly load an association extension?