#288 ✓resolved
Sindre Aarsaether

Strategic eager loading not working?

Reported by Sindre Aarsaether | May 16th, 2008 @ 09:20 AM

@transactions = Transaction.all

@transactions.each do |t|
  t.postings.each do |p|

~ SELECT `id`, `voucher_id`, `title`, `date` FROM `transactions`
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 1
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 15
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 16
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 17
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 18
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 19
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 20
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 21
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 22
~ SELECT `id`, `transaction_id`, `account_id`, `amount`, `date` FROM `postings` WHERE `transaction_id` = 23

In all of my application I can't find one place where strategic eager loading works as it is supposed to? Is this a bug or am I just doing something wrong here?

Comments and changes to this ticket

  • Sindre Aarsaether
  • Sindre Aarsaether

    Sindre Aarsaether May 25th, 2008 @ 09:30 AM

    • State changed from “new” to “open”

    If anyone has time to take care of this before railsconf it'd be grand. It's really one of the great really features of DM, and we have even have examples on the site showing how it works... except it doesn't. I would gladly take this on myself, but don't even follow how this lazy loading is implemented..

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 25th, 2008 @ 06:06 PM

    • Milestone cleared.

    I looked into this and I don't think it is possible to get in before the 0.9 release. Changing the milestone to 0.9.1.

    Currently there is no code or specs at all related to strategic eager loading. I mean, its not like there's a bug in the actual code from preventing this from happening, there is absolutely no code written in dm-core 0.9 to handle this. I don't think there will be time before the 0.9 release to write and fully test it either.

    IMHO this should be one of the first things tackled after the 0.9 release though. Perhaps we can do another point release before Railsconf with this in?

  • Sam Smoot
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) July 9th, 2008 @ 10:46 PM

    • State changed from “open” to “resolved”
    • Tag set to bug, dm-core, priority

    SEL is now available in edge DM.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket