title: rails namespacing models - associations
body: <p>When I try to use a has_many :through  association, it seems to look for the generic key in the join table.  Example</p>
  
  <pre><code>class Ots::Foo &lt; ActiveRecord::Base
    has_many :foo_bars, :class_name =&gt; '::Ots::FooBar', :foreign_key =&gt; :ots_foo_id
    has_many :bars, :class_name =&gt; '::Ots::Bar', :through =&gt; :foo_bars
  end
  
  class Ots::Bar &lt; ActiveRecord::Base
    has_many :foo_bars, :class_name =&gt; '::Ots::FooBar', :foreign_key =&gt; :ots_bar_id
    has_many :bars, :class_name =&gt; '::Ots::Bar', :through =&gt; :foo_bars
  end
  
  class Ots::FooBar &lt; ActiveRecord::Base
    belongs_to :foo, :class_name =&gt; "::Ots::Foo", :foreign_key =&gt; :ots_foo_id
    belongs_to :bar, :class_name =&gt; "::Ots::Bar", :foreign_key =&gt; :ots_bar_id
  end
  
  f = Foo.find(1)
  f.bars  =&gt;# invalid column name 'bar_id'
  </code></pre>
  
  <p>Is this what I should expect?  Is there a more elegant solution to namespacing?</p>