George,
> What the best syntax for finding all clients that share Trips with a
> given client?
It's difficult to test this without a stand-alone script, but
something like this should work:
class Client
has n, :tripClients
has n, :trips, :through => :tripClients
def fellowTravellers
model.all(:trips => trips) - [ self ]
end
end
This should return all the Client objects with the same trips,
filtering out the current Client from the results. If you are using
edge dm-core this should produce a single query when run with a DO
adapter.
--
Dan
(dkubb)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---