neo4jrb/neo4j — pull request #653 by subvertallchris (2014-12-29 07:06:47+00:00)
Title: dependent: :delete, :destroy, :delete_orphans, :destroy_orphans

`:destroy` and `:delete` (should that be `:delete_all`?) do exactly what you expect. The other two...

Imagine a graph of Route and Stop nodes. A Route may have 0 or more Stops, a Stop may be shared between multiple Routes, a Stop must always have at least 1 Route. You want to ensure that when a route is destroyed, its stops will be destroyed if they don't have any other routes. Enter `:delete_orphans` and `:destroy_orphans`. They both perform a match to find nodes whose only relationship of the given type is to the node being destroyed. `:delete` happens in Cypher, `:destroy` happens in Ruby.

There is currently no protection against loops within Ruby. TBD whether we'll handle that in this PR or another one.