I have a couple of models
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
end
and
class Category < ActiveRecord::Base
has_and_belongs_to_many :products
end
Now why can't i say
prod = Product.new
prod.categories << Category.new
Why does has_and_belongs_to_many
adds class methods like Product#categories<<
while it should have added instance methods ?
How can i make use of these class methods to set associations ?