Sha256: 79cee5aa7923e8ef3e616f1f72e6f74575955c3686499a9b6864484796043190
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module Neo4j module Rails module NodePersistence extend TxMethods def initialize(attributes = nil) initialize_relationships initialize_attributes(attributes) end def create node = Neo4j::Node.new init_on_load(node) Neo4j::IdentityMap.add(node, self) init_on_create write_changed_relationships clear_relationships true end def update super write_changed_relationships clear_relationships true end # Reload the object from the DB def reload(options = nil) # Can't reload a none persisted node return self if new_record? clear_changes clear_relationships clear_composition_cache reset_attributes unless reload_from_database set_deleted_properties freeze end self end def freeze_if_deleted unless new_record? Neo4j::IdentityMap.remove_node_by_id(neo_id) unless self.class.load_entity(neo_id) set_deleted_properties freeze end end end def reload_from_database Neo4j::IdentityMap.remove_node_by_id(neo_id) if reloaded = self.class.load_entity(neo_id) send(:attributes=, reloaded.attributes, false) end reloaded end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
neo4j-2.3.0-java | lib/neo4j/rails/node_persistance.rb |
neo4j-2.2.4-java | lib/neo4j/rails/node_persistance.rb |