title: ActiveRecord Find with condition based on associated record having a value in a list
body: <p>With the following Rails models:</p>
  
  <pre><code>class Group &lt; ActiveRecord::Base
    has_many    :group_locations, :dependent =&gt; :restrict
    has_many    :locations, :through =&gt; :group_locations, :dependent =&gt; :restrict
  end
  
  class Location &lt; ActiveRecord::Base
    has_many        :group_locations, :dependent =&gt; :destroy
    has_many        :groups, :through =&gt; :group_locations
  end
  
  class GroupLocation &lt; ActiveRecord::Base
    belongs_to  :group
    belongs_to  :location
  end
  </code></pre>
  
  <p>I am trying to <strong><em>Find</em></strong> all of the locations that are associated with at least one of several groups contained in the string "group_list" (e.g. "1,2,3,4,5").  If it was a field from the Location record, I would specify a condition of "<strong>*field in (#{group_list})*</strong>".  But how do I accomplish my goal when I want to have at least one of the location's "group_location" whose "group_id" is in the list (or, alternatively, one "group" whose group_id is in the list).</p>
  
  <p>I know how to do it with pure SQL, but how do you do it with Rails?</p>