Hi there,
If every "Client" object as a 0 or more "Trip" objects as described
here:

class Client
  has n, :tripClients
  has n, :trips, :through => :tripClients
  ...
end

What the best syntax for finding all clients that share Trips with a
given client?

The best I've come up with so far is:

  def fellowTravellers(client)
    return Client.all( Client.trips.trip_id => client.trips.map{ |
trip| trip.id } )
  end

It seems to work but it does not make good use of datamapper's
cleverness (and it runs 2 queries)
Many thanks
--~--~---------~--~----~------------~-------~--~----~
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