title: rails joins with module name
body: <p>Here is how to join two models</p>
  
  <pre><code>User.where(:id =&gt; 1).joins(:posts)
  </code></pre>
  
  <p>but how to join two models with module/namspace</p>
  
  <pre><code>@schedules= Swimming::Classschedule.joins(:Swimming::Slot).where(:date =&gt; @date)
  </code></pre>
  
  <p>seems not working properly (with error message)</p>
  
  <pre><code>:Swimming is not a class/module
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have updated to 
      @schedules= Swimming::Classschedule.joins(:swimming_slots).where(:date => @date)</p>
  
  <p>and I do have this table </p>
  
  <pre><code>create_table :swimming_classschedules do |t|
    t.integer :slot_id
    t.integer :coach_id
    t.integer :level_id
    t.string :note
  
    t.timestamps
  end
  
  
  create_table :swimming_slots do |t|
    t.string :date
    t.string :start
    t.string :end
  
    t.timestamps
  end
  </code></pre>
  
  <p>Howcome I got this error</p>
  
  <pre><code>Association named 'swimming_slots' was not found; perhaps you misspelled it?
  </code></pre>
  
  <p><strong>update 2</strong></p>
  
  <p>add this line to Swimming::Classschedule module</p>
  
  <p>belongs_to :swimming_slots ,:class_name=>'Swimming::Slot',:foreign_key => "slot_id"</p>
  
  <p>and</p>
  
  <p>change joins to </p>
  
  <pre><code>@schedules= Swimming::Classschedule.joins(:swimming_slots).where(:swimming_slots =&gt;{:date =&gt; @date})
  </code></pre>
  
  <p>Now it works</p>