【发布时间】:2016-02-03 01:38:05
【问题描述】:
我正在删除一个地方,它正在级联 PlaceUpload 的行,但我也想在删除地方时级联 Match 和 TagCostumer 的行。我怎样才能做到这一点?
class Place < ActiveRecord::Base
has_many :place_uploads
end
class PlaceUpload < ActiveRecord::Base
belongs_to :place
has_many :matches
has_many :tags_customers
end
class TagsCustomer < ActiveRecord::Base
belongs_to :place_upload
belongs_to :tag
end
class Match < ActiveRecord::Base
belongs_to :place_upload
belongs_to :customer
end
【问题讨论】:
标签: ruby-on-rails-4 activerecord model-associations