There is mention of DM's support for ":include => [ :association ]"
syntax to eager-load related rows.
(I found it at http://datamapper.org/articles/spotlight_on_laziness.html)

I tried using it to encourage DM to eager-load an association but it
throws the error:
condition :include does not map to a property or relationship in
Client

Has the :include option been deprecated or am I using it incorrectly?
(Without it I'm getting mutliple queries generated as I loop through
the list of clients, reading their addresses etc)

Many thanks,
George

My DM syntax looks like this:
Client.all( :unique => true, :limit => 20, :include =>
[ :notes, :client_addresses, :addresses ] )

The Client model like this:
class Client
  include DataMapper::Resource
  property :id, Serial
  property :name, String, :index => true, :default => ""
  # etc...

  has n, :notes
  has n, :client_addresses
  has n, :addresses, :through => :client_addresses
end

Related thread:
http://groups.google.com/group/datamapper/browse_thread/thread/cc85f7b713e10433

--

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.


Reply via email to