Forum: Ruby on Rails finds on child models

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ae4ee8d59ee17d8672c3a83b7a7dfe8c?d=identicon&s=25 plewizard (Guest)
on 2007-04-02 10:06
(Received via mailing list)
i've looking for the sql to do a comparison of objects in a model's
has_many objects. specifically it's  a simple model:

class Person
   has_many :things

class Things
   belongs_to: person

i can save the person and their 3 (or however many) things.  now i
just need a way to search their 3 things against all other people's 3
things to see if they're the same.  for instance.

@person.thing 1 = 'baseball'
@person.thing 2 = 'tire'
@person.thing 3 = 'shovel'

what's the sql (and it it possible with #find to return a collection
of people with the same things that the person searching using 3 text
fields has?
This topic is locked and can not be replied to.