Displaying 1 result from an estimated 1 matches for "applicable_pricing_rul".
Did you mean:
applicable_pricing_rules
2008 May 08
1
Eager loading of association extensions
...le()
find(:all).select(&:applicable?)
end
end
the code
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 => :applicable_pricing_rules)
cat.applicable_pricing_rules
But maybe there''s a way to eagerly load an association extension?
--
Best regards,
Yuri Leikind
--~...