Module: ActiveGraph::Node::Property::ClassMethods
- Defined in:
- lib/active_graph/node/property.rb
Instance Method Summary collapse
- #association_key?(key) ⇒ Boolean
-
#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?.
Instance Method Details
#association_key?(key) ⇒ Boolean
21 22 23 |
# File 'lib/active_graph/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/active_graph/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 |