Module: ActiveGraph::Relationship::Property::ClassMethods
Instance Method Summary
collapse
#create_method, #creates_unique, #creates_unique?, #creates_unique_option
Instance Method Details
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?
39
40
41
42
43
44
45
46
|
# File 'lib/active_graph/relationship/property.rb', line 39
def (attributes)
return if attributes.blank?
{}.tap do |relationship_props|
attributes.each_key do |key|
relationship_props[key] = attributes.delete(key) if [:from_node, :to_node].include?(key)
end
end
end
|
#id_property_name ⇒ Object
48
49
50
|
# File 'lib/active_graph/relationship/property.rb', line 48
def id_property_name
false
end
|
#load_entity(id) ⇒ Object
74
75
76
|
# File 'lib/active_graph/relationship/property.rb', line 74
def load_entity(id)
ActiveGraph::Node.load(id)
end
|
#valid_class_argument?(class_argument) ⇒ Boolean
66
67
68
69
|
# File 'lib/active_graph/relationship/property.rb', line 66
def valid_class_argument?(class_argument)
[String, Symbol, FalseClass].include?(class_argument.class) ||
(class_argument.is_a?(Array) && class_argument.all? { |c| [String, Symbol].include?(c.class) })
end
|