Commit 8f0730f9 by ivan Lan

Add dependent destroy to the sub_catalogs of Catalog

parent 5e8e5426
......@@ -24,7 +24,7 @@ module Shotengai
class << self
def inherited subclass
subclass.has_many :sub_catalogs, class_name: subclass.name, foreign_key: :super_catalog_id
subclass.has_many :sub_catalogs, class_name: subclass.name, foreign_key: :super_catalog_id, dependent: :destroy
subclass.belongs_to :super_catalog, class_name: subclass.name, optional: true#, touch: true
# subclass.instance_eval("def klass; #{subclass}; end")
super
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment