title: belongs_to with a custom class_name not producing proper foreign key in Rails 3
body: <p>I am updating an application to Rails 3 and I am having trouble creating a custom foreign key.  I have something like this:</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    belongs_to :owner, :class_name =&gt; 'User'
  ...
  end
  
  class User &lt; ActiveRecord::Base
    has_many :products
  ...
  end
  
  class ProductsController &lt; ApplicationController
    before_filter :authenticate_user!
  
    def index
      @products = current_user.products
    end
  end
  </code></pre>
  
  <p>The view:</p>
  
  <pre><code>&lt;%- @products.each do |p| -%&gt;
      &lt;%= p.created_at %&gt;&lt;br /&gt;
  &lt;%- end -%&gt;
  </code></pre>
  
  <p>I get this error in my Rails log:</p>
  
  <pre><code>Mysql::Error: Unknown column 'products.user_id' in 'where clause': SELECT     `products`.* FROM       `products` WHERE     (`products`.user_id = 1)
  </code></pre>
  
  <p>It should see the <code>belongs_to :owner</code> and look for a foreign key called <code>owner_id</code>.  I even tried explicitly setting the foreign key and that does not work.  I also checked lighthouse for a possible Rails 3 bug but no luck.</p>