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