From: Mark Thomas Date: 2009-03-31T11:19:49+09:00 Subject: Re: activerecord query building question On Mar 30, 2:30 pm, Aldric Giacomoni <"aldric[remove]"@trevoke.net> wrote: > I have this: > > require 'activerecord' > > class RefPhys < ActiveRecord::Base >     set_table_name "tbRefPhys" >     has_many :refphyslocations, :foreign_key => "refphysid" > end > > class RefPhysLocation < ActiveRecord::Base >     set_table_name "tbRefPhysLocations" >     belongs_to :refphys, :foreign_key => "refphysid" > end > > I want a list of the refphys names (in refphys) in a specific city (in > refphyslocation). > So... > RefPhys.find(:all, :joins => ['refphyslocation'] .... ? > > I don't grok AR yet :/ It would be something like this: RefPhysLocation.find_all_by_state("OH").each do |location| puts location.refphys.name end