title: Rails - use join only if a condition is true
body: <p>How do I use joins only if a certain condition is true?
  For example, I have this query:</p>
  
  <pre><code>@courses = Course.find(:all,
      :order=&gt; 'courses.name asc',
      :include =&gt; [:units],
      :joins =&gt; :course_sub_responsibles,
      :group =&gt; 'courses.name',
      :conditions =&gt; conditions) 
  </code></pre>
  
  <p>But I need to join the course_sub_responsibles table only in a certain condition.</p>