Module: Neo4j::ActiveNode::Reflection::ClassMethods

Defined in:
lib/neo4j/active_node/reflection.rb

Overview

Adds methods to the class related to creating and retrieving reflections.

Instance Method Summary collapse

Instance Method Details

#reflect_on_all_associations(macro = nil) ⇒ Object

Returns an array containing one reflection for each association declared in the model.



31
32
33
34
# File 'lib/neo4j/active_node/reflection.rb', line 31

def reflect_on_all_associations(macro = nil)
  association_reflections = reflections.values
  macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections
end

#reflect_on_association(association) ⇒ Neo4j::ActiveNode::Reflection::AssociationReflection

Returns of the given association.

Parameters:

  • association (Symbol)

    an association declared on the model

Returns:



26
27
28
# File 'lib/neo4j/active_node/reflection.rb', line 26

def reflect_on_association(association)
  reflections[association.to_sym]
end