Module: Neo4j::ActiveNode::Property::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#association_key?(key) ⇒ Boolean

Returns:



21
22
23
# File 'lib/neo4j/active_node/property.rb', line 21

def association_key?(key)
  association_method_keys.include?(key.to_sym)
end

#extract_association_attributes!(attributes) ⇒ Object

Extracts keys from attributes hash which are associations of the model TODO: Validate separately that relationships are getting the right values? Perhaps also store the values and persist relationships on save?



14
15
16
17
18
19
# File 'lib/neo4j/active_node/property.rb', line 14

def extract_association_attributes!(attributes)
  return unless contains_association?(attributes)
  attributes.each_with_object({}) do |(key, _), result|
    result[key] = attributes.delete(key) if self.association_key?(key)
  end
end