You must rewrite #clone so that all associations are also cloned, e.g.
class Category < ActiveRecord::Base
has_many :products
alias_method :original_clone, clone
def clone
category = self.original_clone
category.products = self.products.clone
end
end
... don't forget to do the same on Product and ProductVariant.
Pablo source
share