Hi everyone,
Is there any possibility to make datamapper load all fields for a
model in such situation:
http://gist.github.com/343851#file_lazy_load_issue.rb
So when I do:
Master.first.slaves.to_a.each do |s|
p s.name
end
it first fetch all slaves:
SELECT "id", "name" FROM "masters" ORDER BY "id" LIMIT 1
SELECT "id", "discriminator", "master_id" FROM "slaves" WHERE
("master_id" = 1 AND "discriminator" IN ('Slave', 'Slave::Nested'))
ORDER BY "id"
and then lazy load "name" property
SELECT "id", "discriminator", "name" FROM "slaves" WHERE "id" = 1
ORDER BY "id"
SELECT "id", "discriminator", "name" FROM "slaves" WHERE "id" = 2
ORDER BY "id"
SELECT "id", "discriminator", "name" FROM "slaves" WHERE "id" = 3
ORDER BY "id"
SELECT "id", "discriminator", "name" FROM "slaves" WHERE "id" = 4
ORDER BY "id"
I want datamapper to load all properties on the first slaves query.
Thanks,
Dawid
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.