find on a chained relationship

Hello Anthony,

I have a one-to-many relationship from person to city. I also have another one-to-many relationship from city-to-county. Is there a way to find all people in a county from the people class (i.e. @people = People.City.County.find(1)?

Below are my models for the three classes.

class Person < ActiveRecord::Base belongs_to : city end

class City < ActiveRecord::Base has_many :people belongs_to :county end

class County < ACtiveRecord::Base has_many :cities end

Maybe something like that :

cities = Country.find(1).cities @people = Person.find(:all, :conditions => ['city_id IN (?)', cities])

    -- Jean-Fran├žois.