title: I want to write following query rails way
body: <pre><code>select DISTINCT firstname 
    from users u 
      inner join  members m 
        on m.user_id = u.id 
      inner join  member_roles m1 
        on m1.member_id = m.id 
      inner join roles r
        on r.id = m1.role_id  
    where r.name  = 'Project Coordinator'
  </code></pre>
  
  <p>this gives perfect result </p>
  
  <p>I tried to write above query rails way
  like</p>
  
  <pre><code>s = MemberRole.joins(:role).where("roles.name" =&gt; "Project Coordinator")
  
  @u = User.select("users.firstname").includes(:members =&gt; s )
  </code></pre>
  
  <p>but seems doesnt work  any help??
  thanks in advance</p>