module ActiveGraph::Relationship::Property::ClassMethods

Public Instance Methods

extract_association_attributes!(attributes) click to toggle source

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

   # File lib/active_graph/relationship/property.rb
41 def extract_association_attributes!(attributes)
42   return if attributes.blank?
43   {}.tap do |relationship_props|
44     attributes.each_key do |key|
45       relationship_props[key] = attributes.delete(key) if [:from_node, :to_node].include?(key)
46     end
47   end
48 end
id_property_name() click to toggle source
   # File lib/active_graph/relationship/property.rb
50 def id_property_name
51   false
52 end
load_entity(id) click to toggle source
   # File lib/active_graph/relationship/property.rb
76 def load_entity(id)
77   ActiveGraph::Node.load(id)
78 end
valid_class_argument?(class_argument) click to toggle source
   # File lib/active_graph/relationship/property.rb
68 def valid_class_argument?(class_argument)
69   [String, Symbol, FalseClass].include?(class_argument.class) ||
70     (class_argument.is_a?(Array) && class_argument.all? { |c| [String, Symbol].include?(c.class) })
71 end