module ActiveFedora::Persistence
def delete(opts = {})
(**opts)
-
:eradicate
(Boolean
) -- if passed in, eradicate the tombstone from Fedora
Parameters:
-
opts
(Hash
) --
def delete(opts = {}) return self if new_record? @destroyed = true reflections.each_pair do |name, reflection| if reflection.macro == :has_many association(name.to_sym).delete_all end end id = self.id ## cache so it's still available after delete # Clear out the ETag @ldp_source = build_ldp_resource(id) begin @ldp_source.delete rescue Ldp::NotFound raise ObjectNotFoundError, "Unable to find #{id} in the repository" end ActiveFedora::SolrService.delete(id) if ENABLE_SOLR_UPDATES if opts[:eradicate] self.class.eradicate(id) end freeze end