Sha256: 55551cd1bb0795350b1a3dd8b75a46192d216592b78cfd81d5f99e30c427c4ac
Contents?: true
Size: 693 Bytes
Versions: 5
Compression:
Stored size: 693 Bytes
Contents
module Adminos::NestedSet::SafeDestroy extend ActiveSupport::Concern module ClassMethods def safe_destroy order('depth DESC').each { |page| page.destroy } end end def safe_destroy self.move_children_to_root! self.destroy end def safe_destroy(*args) options = args.extract_options! case options[:children_to] when :parent self.move_children_to_parent! else self.move_children_to_root! end self.destroy unless options[:without_destroy] end def move_children_to_root! self.children.each do |child| child.move_to_root child.set_published_off if child.respond_to?(:set_published_off) end end end
Version data entries
5 entries across 5 versions & 1 rubygems