Sha256: 296d9820dacb02ab2537f7641778913b2dbd9d2161cb7d050c480971585c9011
Contents?: true
Size: 562 Bytes
Versions: 18
Compression:
Stored size: 562 Bytes
Contents
require 'mongoid' class Base include Mongoid::Document include Mongoid::Timestamps include Mongoid::Versioning include Mongoid::Paranoia #associations embeds_many :connections accepts_nested_attributes_for :connections after_destroy :remove_slugs after_destroy :remove_connections def remove_slugs Slug.where(:document_id => id).destroy end def remove_connections records = Base.where(:'connections.parent_id' => id) records.each do |record| record.connections.where(:parent_id => id).destroy_all end end end
Version data entries
18 entries across 18 versions & 1 rubygems