Module: Neo4j::ActiveRel
- Extended by:
- ActiveSupport::Concern
- Includes:
- Callbacks, Initialize, Persistence, Property, Query, Types, Validations, Shared, Shared::Enum, Shared::Identity, Shared::Marshal, Shared::PermittedAttributes, Shared::SerializedProperties
- Defined in:
- lib/neo4j/active_rel.rb,
lib/neo4j/active_rel/query.rb,
lib/neo4j/active_rel/types.rb,
lib/neo4j/active_rel/property.rb,
lib/neo4j/active_rel/callbacks.rb,
lib/neo4j/active_rel/initialize.rb,
lib/neo4j/active_rel/persistence.rb,
lib/neo4j/active_rel/validations.rb,
lib/neo4j/active_rel/related_node.rb
Overview
Makes Neo4j Relationships more or less act like ActiveRecord objects. See documentation at github.com/neo4jrb/neo4j/wiki/Neo4j%3A%3AActiveRel
Defined Under Namespace
Modules: Callbacks, Initialize, Persistence, Property, Query, Types, Validations Classes: FrozenRelError, RelatedNode
Constant Summary collapse
- MARSHAL_INSTANCE_VARIABLES =
[:@attributes, :@rel_type, :@_persisted_obj]
Constants included from Types
Constants included from Shared::Attributes
Shared::Attributes::DEPRECATED_OBJECT_METHODS
Instance Attribute Summary
Attributes included from Shared::Property
Instance Method Summary collapse
- #initialize(from_node = nil, to_node = nil, args = nil) ⇒ Object
- #neo4j_obj ⇒ Object
- #node_cypher_representation(node) ⇒ Object
Methods included from Shared::PermittedAttributes
#attributes=, #process_attributes
Methods included from Callbacks
Methods included from Shared::Callbacks
#conditional_callback, #destroy, #touch
Methods included from Shared::Validations
#read_attribute_for_validation, #save, #valid?
Methods included from Persistence
#concurrent_increment!, #create_method, #create_model, #cypher_identifier, #from_node_identifier, #from_node_identifier=, #query_as, #save, #save!, #to_node_identifier, #to_node_identifier=, #validate_has_one_rel
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 Property
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 Shared::Marshal
Methods included from Shared::Identity
#==, #hash, #id, #neo_id, #to_key
Methods included from Initialize
#init_on_load, #init_on_reload
Methods included from Shared::Initialize
Methods included from Shared
#declared_properties, #neo4j_query
Instance Method Details
#initialize(from_node = nil, to_node = nil, args = nil) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/neo4j/active_rel.rb', line 25 def initialize(from_node = nil, to_node = nil, args = nil) load_nodes(node_or_nil(from_node), node_or_nil(to_node)) resolved_args = hash_or_nil(from_node, args) symbol_args = sanitize_input_parameters(resolved_args) super(symbol_args) end |
#neo4j_obj ⇒ Object
40 41 42 |
# File 'lib/neo4j/active_rel.rb', line 40 def neo4j_obj _persisted_obj || fail('Tried to access native neo4j object on a non persisted object') end |
#node_cypher_representation(node) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/neo4j/active_rel.rb', line 32 def node_cypher_representation(node) node_class = node.class id_name = node_class.id_property_name labels = ':' + node_class.mapped_label_names.join(':') "(#{labels} {#{id_name}: #{node.id.inspect}})" end |