The newer impatient download style uses several queries to load associations. Can I add conditions for these additional downloadable download requests? eg.
Bakery.find(:all, :include => :bakers)
will generate the desired download request, similar to this:
SELECT bakers . * FROM bakers WHERE ( bakers .bakery_id IN (1,2,3,4,5))
Can I add conditions for this impatient download request?
Update: To (possibly) make this clearer, the query I want to replicate using AR (sans SQL) is:
SELECT * FROM bakeries LEFT JOIN bakers ON bakeries.id = bakers.bakery_id AND bakers.hat = 'on'
In particular, I was hoping I could modify the second loaded SQL statement:
SELECT bakers . * FROM bakers WHERE ( bakers .bakery_id IN (1,2,3,4,5) and bakers .hat = 'on')
Is this possible, or should I use SQL? Just looking for a "Rails" way to do this. :)
source share