If Product and Category models are in a habtm relationship, i.e.
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :products
end
I want a piece of code to be executed every time a product is connected
to a
category.
Where do I put this code? Which callback (and on which model) will be
triggered?
Any hints appreciated. Thanks for help.
–
- Kazim Z.
Blog: http://tuxplayground.blogspot.com