app/models/editable_components/block.rb in editable_components-0.1.3 vs app/models/editable_components/block.rb in editable_components-0.1.4
- old
+ new
@@ -6,11 +6,11 @@
serialize :options, JSON
serialize :validations, JSON
# --- relations ---------------------------------------------------------- #
belongs_to :parent, polymorphic: true
- has_many :ec_blocks, as: :parent, foreign_key: 'parent_id', class_name: 'Block'
- has_many :items
+ has_many :ec_blocks, as: :parent, dependent: :destroy, foreign_key: 'parent_id', class_name: 'Block'
+ has_many :items, dependent: :destroy
accepts_nested_attributes_for :ec_blocks, allow_destroy: true
accepts_nested_attributes_for :items
# --- hooks -------------------------------------------------------------- #
before_create :on_before_create