AR.find :include is adding stuff I don't want

When I use the code above, I get data from Article (good), Extras (good), and Assets (bad), and nothing from Pages (curious).

I don't understand why Assets is being included, and I don't know how to keep that data out of the results.

Odd. Maybe you could show the sql it is executing ?

Fred

Frederick Cheung wrote:

So, I dunno. But shouldn't that second finder case (without :include) not be returning :assets nor :extras? I end up using debug() to output the results to confirm what is actually being loaded, and I get those two associations, but no :pages data. Seems weird.

Random question: are you doing this from the console or is this output from an app. Are you sure the load is coming from the find and not from the association been accessed subsequently (eg put a log statement after the find(..., :include) ? )

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:

So, I dunno. But shouldn't that second finder case (without :include) not be returning :assets nor :extras? I end up using debug() to output the results to confirm what is actually being loaded, and I get those two associations, but no :pages data. Seems weird.

Random question: are you doing this from the console or is this output from an app. Are you sure the load is coming from the find and not from the association been accessed subsequently (eg put a log statement after the find(..., :include) ? )

@#$#! After writing a big long thing to prove there was no other action taking place, and taking one more wider look before sending it to be sure I wasn't making an idiot of myself, I just scrolled down a little further in the model to re-discover an after_find I wrote which would in fact touch assets & extras.

I had just so compartmentalized the :include thing in my mind, I wasn't remembering after_find.

Egads. So sorry to waste your time Fred. But proving there was no log statement question pushed me to at least solve the (not so puzzling) puzzle. Thanks.

-- gw

@#$#! After writing a big long thing to prove there was no other
action taking place, and taking one more wider look before sending it to be sure I wasn't making an idiot of myself, I just scrolled down a little further in the model to re-discover an after_find I wrote which
would in fact touch assets & extras.

I had just so compartmentalized the :include thing in my mind, I
wasn't remembering after_find.

Egads. So sorry to waste your time Fred. But proving there was no log statement question pushed me to at least solve the (not so puzzling) puzzle. Thanks.

D'oh! Happens to all of us :slight_smile:

Fred