我是新来的铁轨,我有这个问题Rails协会模型
我有三个模型,供应商模型,产品模型和分类模型,所有模型都有关系。
如果您输入产品,您可以选择该产品的提供商和分类。
我无法删除提供商或一个类别,因为它们涉及到产品
但我可以删除产品没有问题
正如我能设法消除,而不影响产品的提供者或gategorie?
class Categorie < ActiveRecord::Base
belongs_to :user
end
class Product < ActiveRecord::Base
belongs_to :user
belongs_to :provider
belongs_to :categorie
end
class Provider < ActiveRecord::Base
belongs_to :user
has_many :products
end
谢谢!