module ActiveFedora::Persistence::ClassMethods

def create(attributes = nil, &block)

end
u.is_admin = false
User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) do |u|
# Creating an Array of new objects using a block, where the block is executed for each object:

end
u.is_admin = false
User.create(:first_name => 'Jamie') do |u|
# Create a single object and pass it into a block to set other attributes.

User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }])
# Create an Array of new objects

User.create(:first_name => 'Jamie')
# Create a single new object
==== Examples

attributes on the objects that are to be created.
The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the

The resulting object is returned whether the object was saved successfully to the repository or not.
Creates an object (or multiple objects) and saves it to the repository, if validations pass.
def create(attributes = nil, &block)
  if attributes.is_a?(Array)
    attributes.collect { |attr| create(attr, &block) }
  else
    object = new(attributes, &block)
    object.save
    object
  end
end

def delete_tombstone(uri)

def delete_tombstone(uri)
  tombstone = ActiveFedora::Base.id_to_uri(uri) + "/fcr:tombstone"
  ActiveFedora.fedora.connection.delete(tombstone)
  true
end

def eradicate(uri)

method. It shouldn't be used in the general course of repository operations.
NOTE: this is in violation of the linked data platform and is only here as a convience
Removes an object's tombstone so another object with the same uri may be created.
def eradicate(uri)
  gone?(uri) ? delete_tombstone(uri) : false
end

def gone?(uri)

Parameters:
  • uri () -- id in fedora that may or may not have been deleted
def gone?(uri)
  ActiveFedora::Base.find(uri)
  false
rescue Ldp::Gone
  true
rescue ActiveFedora::ObjectNotFoundError
  false
end