title: rails has_many :through NameError
body: <p>I have the following setup</p>
  
  <pre><code>class Category &lt; ActiveRecord::Base 
  
  has_many :category_products
  has_many :products, through: :category_products
  
  end
  
  class Product &lt; ActiveRecord::Base
  
  has_many :category_products
  has_many :categories, through: :category_products
  
  end
  
  class CategoryProducts &lt; ActiveRecord::Base
  belongs_to :category
  belongs_to :product
  end
  </code></pre>
  
  <p>In rails console I try allocate category_ids using the following command
  p.category_ids = [1,2]  (where p = Product.first) I get</p>
  
  <pre><code>NameError: uninitialized constant Product::CategoryProduct
  </code></pre>
  
  <p>any advice?</p>
  
  <p>thanks</p>