Yeah, thanks Dan, that's what I'm after, I'd better move to edge asap! George
On Nov 9, 8:10 pm, "Dan Kubb (dkubb)" <dan.k...@gmail.com> wrote: > 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 datamapper@googlegroups.com To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---