ActiveNode¶
Makes Neo4j nodes and relationships behave like ActiveRecord objects. By including this module in your class it will create a mapping for the node to your ruby class by using a Neo4j Label with the same name as the class. When the node is loaded from the database it will check if there is a ruby class for the labels it has. If there Ruby class with the same name as the label then the Neo4j node will be wrapped in a new object of that class.
= ClassMethods * {Neo4j::ActiveNode::Labels::ClassMethods} defines methods like: <tt>index</tt> and <tt>find</tt> * {Neo4j::ActiveNode::Persistence::ClassMethods} defines methods like: <tt>create</tt> and <tt>create!</tt> * {Neo4j::ActiveNode::Property::ClassMethods} defines methods like: <tt>property</tt>.
Constants¶
- WRAPPED_CLASSES
- MODELS_FOR_LABELS_CACHE
- USES_CLASSNAME
Files¶
- lib/neo4j/active_node.rb:23
- lib/neo4j/active_node/rels.rb:1
- lib/neo4j/active_node/query.rb:2
- lib/neo4j/active_node/has_n.rb:1
- lib/neo4j/active_node/scope.rb:3
- lib/neo4j/active_node/labels.rb:2
- lib/neo4j/active_node/property.rb:1
- lib/neo4j/active_node/callbacks.rb:2
- lib/neo4j/active_node/dependent.rb:2
- lib/neo4j/active_node/reflection.rb:1
- lib/neo4j/active_node/persistence.rb:1
- lib/neo4j/active_node/id_property.rb:1
- lib/neo4j/active_node/validations.rb:2
- lib/neo4j/active_node/orm_adapter.rb:4
- lib/neo4j/active_node/query_methods.rb:2
- lib/neo4j/active_node/query/query_proxy.rb:2
- lib/neo4j/active_node/has_n/association.rb:4
- lib/neo4j/active_node/query/query_proxy_link.rb:2
- lib/neo4j/active_node/query/query_proxy_methods.rb:2
- lib/neo4j/active_node/query/query_proxy_enumerable.rb:2
- lib/neo4j/active_node/dependent/query_proxy_methods.rb:2
- lib/neo4j/active_node/dependent/association_methods.rb:2
- lib/neo4j/active_node/query/query_proxy_eager_loading.rb:2
- lib/neo4j/active_node/query/query_proxy_find_in_batches.rb:2
Methods¶
#==
- #[]
Returning nil when we get ActiveAttr::UnknownAttributeError from ActiveAttr
+ show/hide code
#_active_record_destroyed_behavior?
#_create_node
- #_destroyed_double_check?
These two methods should be removed in 6.0.0
+ show/hide code
- #_persisted_obj
Returns the value of attribute _persisted_obj
+ show/hide code
#_rels_delegator
- #add_label
adds one or more labels
+ show/hide code
#apply_default_values
- #as
Starts a new QueryProxy with the starting identifier set to the given argument and QueryProxy source_object set to the node instance. This method does not exist within QueryProxy and can only be used to start a new chain.
+ show/hide code
#association_proxy
- #association_proxy_cache
Returns the current AssociationProxy cache for the association cache. It is in the format { :association_name => AssociationProxy} This is so that we * don’t need to re-build the QueryProxy objects * also because the QueryProxy object caches it’s results * so we don’t need to query again * so that we can cache results from association calls or eager loading
+ show/hide code
#association_proxy_cache_fetch
#association_query_proxy
#cache_key
- #called_by
Returns the value of attribute called_by
+ show/hide code
- #called_by=
Sets the attribute called_by
+ show/hide code
#declared_property_manager
#default_properties
#default_properties=
#default_property
#dependent_children
- #destroy
nodoc:
- #destroyed?
Returns +true+ if the object was destroyed.
+ show/hide code
#eql?
#exist?
#freeze
#frozen?
#hash
#id
- #init_on_load
called when loading the node from the database
+ show/hide code
#initialize
#inspect
#labels
#neo4j_obj
#neo_id
- #new?
Returns +true+ if the record hasn’t been saved to Neo4j yet.
+ show/hide code
- #new_record?
Returns +true+ if the record hasn’t been saved to Neo4j yet.
+ show/hide code
- #persisted?
Returns +true+ if the record is persisted, i.e. it’s not a new record and it was not destroyed
+ show/hide code
#props
- #query_as
Returns a Query object with the current node matched the specified variable name
+ show/hide code
- #read_attribute
Returning nil when we get ActiveAttr::UnknownAttributeError from ActiveAttr
+ show/hide code
- #read_attribute_for_validation
Implements the ActiveModel::Validation hook method.
+ show/hide code
#reload
#reload_from_database
- #remove_label
Removes one or more labels Be careful, don’t remove the label representing the Ruby class.
+ show/hide code
- #save
The validation process on save can be skipped by passing false. The regular Model#save method is replaced with this when the validations module is mixed in, which it is by default.
+ show/hide code
- #save!
Persist the object to the database. Validations and Callbacks are included by default but validation can be disabled by passing :validate => false to #save! Creates a new transaction.
+ show/hide code
#send_props
#serializable_hash
#serialized_properties
- #to_key
Returns an Enumerable of all (primary) key attributes or nil if model.persisted? is false
+ show/hide code
- #touch
nodoc:
- #update
Updates this resource with all the attributes from the passed-in Hash and requests that the record be saved. If saving fails because the resource is invalid then false will be returned.
+ show/hide code
- #update!
Same as {#update_attributes}, but raises an exception if saving fails.
+ show/hide code
- #update_attribute
Convenience method to set attribute and #save at the same time
+ show/hide code
- #update_attribute!
Convenience method to set attribute and #save! at the same time
+ show/hide code
- #update_attributes
Updates this resource with all the attributes from the passed-in Hash and requests that the record be saved. If saving fails because the resource is invalid then false will be returned.
+ show/hide code
- #update_attributes!
Same as {#update_attributes}, but raises an exception if saving fails.
+ show/hide code
#valid?
- #wrapper
Implements the Neo4j::Node#wrapper and Neo4j::Relationship#wrapper method so that we don’t have to care if the node is wrapped or not.
+ show/hide code