activegraph icon indicating copy to clipboard operation
activegraph copied to clipboard

Feature request: allow override of default #destroy behavior

Open leviwilson opened this issue 5 years ago • 0 comments

Additional information which could be helpful if relevant to your issue:

Code example

When #destroy is called on an Neo4j::ActiveNode model, the default behavior is such that it effectively does a DETACH DELETE.

irb(main):009:0> c.destroy
 CYPHER
  MATCH (n)
  WHERE (ID(n) = {ID_n})
  OPTIONAL MATCH (n)-[r]-()
  DELETE
    n,
    r | {:ID_n=>2100}

For some things this is fine, but in other cases where you desire data integrity this is less than desirable.

Feature Request

It would be beneficial if we were able to specify the default behavior for a given model such that you could make it so it doesn't do a detach delete so that the #destroy will throw an exception if there are relationships to the node.

leviwilson avatar Feb 19 '19 17:02 leviwilson