lib/model/edge.rb in active-orient-0.5 vs lib/model/edge.rb in active-orient-0.6
- old
+ new
@@ -12,11 +12,11 @@
Creates individual indices for child-classes if applied to the class itself.
=end
def uniq_index
create_property :in, type: :link, linked_class: :V
create_property :out, type: :link, linked_class: :V
- create_index "#{self.name}_idx", on: [ :in, :out ]
+ create_index "#{ref_name}_idx", on: [ :in, :out ]
end
=begin
Instantiate a new Edge between two Vertices
The parameters »from« **or** »to« can take a list of model-records. Then subsequent edges are created.
@@ -27,23 +27,25 @@
def create **keyword_arguments
new_edge = db.create_edge self, **keyword_arguments
new_edge = new_edge.pop if new_edge.is_a?( Array) && new_edge.size == 1
+ # to.reload! if to.is_a? ActiveOrient::Model
+ # from.reload! if from.is_a? ActiveOrient::Model
# vertices must be reloaded
new_edge # returns the created edge (or an array of created edges
end
- # to do
- # def delete
- # delete an edge (as class method)
- # and
- # def remove
- # delete an edge (as instance method)
- #
- def delete where: attributes
- puts "work in progress"
+=begin
+Edge#delete fires a "delete edge" command to the database.
+The where statement can be empty ( "" or {}"), then all edges are removed
+
+The rid-cache is reseted, too
+=end
+ def delete where:
+ db.execute { "delete edge #{ref_name} #{db.compose_where(where)}" }
+ reset_rid_store
end
# remove works on record-level
end
def remove