Class: Neo4j::Rails::Relationship

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Translation
Includes:
ActiveModel::Dirty, ActiveModel::MassAssignmentSecurity, ActiveModel::Observing, Attributes, Callbacks, Compositions, Finders, Identity, Persistence, RelationshipPersistence, Serialization, Timestamps, Validations, Neo4j::RelationshipMixin
Defined in:
lib/neo4j/rails/relationship.rb

Overview

Includes the Neo4j::RelationshipMixin and adds ActiveRecord/Model like behaviour. That means for example that you don't have to care about transactions since they will be automatically be created when needed.

By default all relationships created by hte Neo4j::Rails::Model will be of this type unless it is specified by an has_n(…).relationship(relationship_class),

Notice that this class works like any ActiveModel compliant object with callbacks and validations. It also implement timestamps (like active record), just add a updated_at or created_at attribute.

Constant Summary

Constant Summary

Constants included from Timestamps

Timestamps::TIMESTAMP_PROPERTIES

Constants included from Callbacks

Callbacks::CALLBACKS

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Compositions

#clear_composition_cache, #composition_cache

Methods included from Timestamps

#create_timestamp, #new_or_changed?, #update_timestamp, #write_date_or_timestamp

Methods included from Callbacks

#destroy_with_callbacks, #valid_with_callbacks?

Methods included from Validations

#read_attribute_for_validation, #save, #valid?

Methods included from Attributes

#_classname, #attribute?, #attribute_defaults, #attribute_names, #attributes, #attributes=, #hash, #property?, #property_changed?, #property_names, #props, #read_attribute, #read_attribute_with_type_conversion, #to_key, #to_model, #to_param, #update_attribute, #update_attributes, #update_attributes!, #write_attribute, #write_attribute_with_type_conversion

Methods included from TxMethods

#tx_methods

Methods included from RelationshipPersistence

#create, #end_node, #freeze_if_deleted, #initialize, #other_node, #rel_type, #reload, #reload_from_database, #start_node

Methods included from Persistence

#create_or_updating?, #delete, #destroy, #destroyed?, #freeze, #frozen?, #new_record?, #persisted?, #save, #save!

Methods included from Identity

#==, #getId, #id, #neo_id

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Neo4j::Rails::Attributes

Class Method Details

+ (Object) _all



42
43
44
# File 'lib/neo4j/rails/relationship.rb', line 42

def _all
  _indexer.find(:_classname => self)
end

Instance Method Details

- (Object) to_s



34
35
36
# File 'lib/neo4j/rails/relationship.rb', line 34

def to_s
  "id: #{self.object_id}  start_node: #{start_node.id} end_node: #{end_node.id} type:#{@type}"
end