Module: Neo4j::ActiveNode
- Extended by:
- ActiveSupport::Concern
- Includes:
- Callbacks, Dependent, Enum, HasN, IdProperty, Initialize, Labels, Persistence, Property, Query, Reflection, Rels, Scope, Unpersisted, Validations, Shared, Shared::Identity, Shared::Marshal, Shared::PermittedAttributes, Shared::SerializedProperties
- Included in:
- Migrations::SchemaMigration
- Defined in:
- lib/neo4j/active_node.rb,
lib/neo4j/active_node/enum.rb,
lib/neo4j/active_node/rels.rb,
lib/neo4j/active_node/has_n.rb,
lib/neo4j/active_node/query.rb,
lib/neo4j/active_node/scope.rb,
lib/neo4j/active_node/labels.rb,
lib/neo4j/active_node/property.rb,
lib/neo4j/active_node/callbacks.rb,
lib/neo4j/active_node/dependent.rb,
lib/neo4j/active_node/reflection.rb,
lib/neo4j/active_node/id_property.rb,
lib/neo4j/active_node/orm_adapter.rb,
lib/neo4j/active_node/persistence.rb,
lib/neo4j/active_node/unpersisted.rb,
lib/neo4j/active_node/validations.rb,
lib/neo4j/active_node/query_methods.rb,
lib/neo4j/active_node/has_n/association.rb,
lib/neo4j/active_node/query/query_proxy.rb,
lib/neo4j/active_node/node_list_formatter.rb,
lib/neo4j/active_node/query/query_proxy_link.rb,
lib/neo4j/active_node/query/query_proxy_methods.rb,
lib/neo4j/active_node/query/query_proxy_enumerable.rb,
lib/neo4j/active_node/dependent/association_methods.rb,
lib/neo4j/active_node/dependent/query_proxy_methods.rb,
lib/neo4j/active_node/query/query_proxy_eager_loading.rb,
lib/neo4j/active_node/has_n/association_cypher_methods.rb,
lib/neo4j/active_node/query/query_proxy_find_in_batches.rb,
lib/neo4j/active_node/query/query_proxy_methods_of_mass_updating.rb,
lib/neo4j/active_node/query/query_proxy_eager_loading/association_tree.rb
Overview
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
-
Labels::ClassMethods defines methods like:
index
andfind
-
Persistence::ClassMethods defines methods like:
create
andcreate!
-
Property::ClassMethods defines methods like:
property
.
Defined Under Namespace
Modules: Callbacks, ClassMethods, Dependent, Enum, HasN, IdProperty, Initialize, Labels, Persistence, Property, Query, QueryMethods, Reflection, Rels, Scope, Unpersisted, Validations Classes: NodeListFormatter, OrmAdapter
Constant Summary collapse
- MARSHAL_INSTANCE_VARIABLES =
[:@attributes, :@_persisted_obj, :@default_property_value]
- LOADED_CLASSES =
[]
Constants included from Labels
Labels::MODELS_FOR_LABELS_CACHE, Labels::WRAPPED_CLASSES
Constants included from Labels::Reloading
Labels::Reloading::MODELS_TO_RELOAD
Constants included from Shared::Attributes
Shared::Attributes::DEPRECATED_OBJECT_METHODS
Instance Attribute Summary
Attributes included from Dependent
Attributes included from Shared::Property
Attributes included from IdProperty::Accessor
Attributes included from Initialize
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Shared::PermittedAttributes
#attributes=, #process_attributes
Methods included from Dependent
Methods included from HasN
#active_rel_corresponding_rel, #association_proxy, #association_proxy_cache, #association_proxy_cache_fetch, #association_proxy_hash, #association_query_proxy, #reverse_association, #validate_has_one_rel!, #validate_reverse_has_one_active_rel, #validate_reverse_has_one_core_rel
Methods included from Unpersisted
#clear_deferred_nodes_for_association, #defer_create, #deferred_create_cache, #deferred_nodes_for_association, #pending_deferred_creations?
Methods included from Rels
Methods included from Labels
_wrapped_classes, #add_label, #add_labels, add_wrapped_class, clear_wrapped_models, #labels, model_for_labels, #remove_label, #remove_labels
Methods included from Labels::Reloading
Methods included from Query
Methods included from Shared::Callbacks
#conditional_callback, #destroy, #touch
Methods included from Validations
Methods included from Shared::Validations
#read_attribute_for_validation, #save, #valid?
Methods included from Persistence
#_create_node, #concurrent_increment!, #create_model, #inject_primary_key!, #labels_for_create, #save, #save!
Methods included from Shared::Persistence
#apply_default_values, #cache_key, #concurrent_increment!, #create_or_update, #destroy, #destroyed?, #exist?, #freeze, #frozen?, #increment, #increment!, #new_record?, #persisted?, #props, #props_for_create, #props_for_persistence, #props_for_update, #reload, #reload_from_database, #skip_update?, #touch, #update, #update!, #update_attribute, #update_attribute!, #update_db_properties, #update_db_property, #update_model
Methods included from Shared::Property
#inject_defaults!, #inspect, #mutations_from_database, #read_attribute, #reload_properties!, #send_props, #undeclared_properties=
Methods included from Shared::TypecastedAttributes
Methods included from Shared::Attributes
#==, #attributes, #query_attribute, #write_attribute
Methods included from Shared::MassAssignment
#add_undeclared_property, #assign_attributes, #attributes=
Methods included from Shared::SerializedProperties
#serializable_hash, #serialized_properties
Methods included from IdProperty::Accessor
#default_properties, #default_properties=, #default_property, #default_property_key
Methods included from Initialize
#init_on_load, #init_on_reload
Methods included from Shared::Initialize
Methods included from Shared::Marshal
Methods included from Shared::Identity
#==, #hash, #id, #neo_id, #to_key
Methods included from Shared
#declared_properties, #neo4j_query
Class Method Details
.loaded_classes ⇒ Object
62 63 64 |
# File 'lib/neo4j/active_node.rb', line 62 def self.loaded_classes LOADED_CLASSES end |
Instance Method Details
#initialize(args = nil) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/neo4j/active_node.rb', line 49 def initialize(args = nil) self.class.ensure_id_property_info! # So that we make sure all objects have an id_property args = sanitize_input_parameters(args) super(args) end |
#neo4j_obj ⇒ Object
56 57 58 |
# File 'lib/neo4j/active_node.rb', line 56 def neo4j_obj _persisted_obj || fail('Tried to access native neo4j object on a non persisted object') end |