neo4jrb/neo4j — pull request #651 by subvertallchris (2014-12-26 21:01:42+00:00)
Title: don't use persisted?, use _persisted_obj and neo_id, rely on cypher errors

`persisted?` causes a call to the DB to check whether an object exists. It was being called TWICE during node update and relationship creation, making each of those n + 2 queries! Totally insane.

To fix this, we can use the presence of `_persisted_obj` (the underlying Neo4j::CypherNode or Neo4j::EmbeddedNode object) as evidence that we're not working with an unsaved node. When needed,the database will give an error to indicate you're trying to work with a node that has been destroyed since instantiating the object. If someone doesn't want this to happen, then can check `persisted?` themselves in their app.

This will result in a performance boost across the board.