module Neo4j::Rails::Persistence::ClassMethods

Public Instance Methods

create(*args) { |o| ... } click to toggle source

Initialize a model and set a bunch of attributes at the same time. Returns the object whether saved successfully or not.

# File lib/neo4j/rails/persistence.rb, line 111
def create(*args)
  new(*args).tap do |o|
    yield o if block_given?
    o.save
  end
end
create!(*args) { |o| ... } click to toggle source

Same as #create, but raises an error if there is a problem during save. Returns the object whether saved successfully or not.

# File lib/neo4j/rails/persistence.rb, line 120
def create!(*args)
  new(*args).tap do |o|
    yield o if block_given?
    o.save!
  end
end
destroy_all() click to toggle source

Destroy each node in turn. Runs the destroy callbacks for each node.

# File lib/neo4j/rails/persistence.rb, line 128
def destroy_all
  all.each do |n|
    n.destroy
  end
end