Sha256: 8dad23d9e9315e4a2ad68ab5611d041d8c7cccfde513174136df55affbfad4ae

Contents?: true

Size: 792 Bytes

Versions: 6

Compression:

Stored size: 792 Bytes

Contents

module Neo4j::ActiveNode
  module Property
    extend ActiveSupport::Concern
    include Neo4j::Shared::Property

    def initialize(attributes = {}, options = {})
      super(attributes, options)

      send_props(@relationship_props) if persisted? && !@relationship_props.nil?
    end

    module ClassMethods
      # 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?
      def extract_association_attributes!(attributes)
        attributes.keys.each_with_object({}) do |key, association_props|
          association_props[key] = attributes.delete(key) if self.association?(key)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
neo4j-4.1.5 lib/neo4j/active_node/property.rb
neo4j-4.1.4 lib/neo4j/active_node/property.rb
neo4j-4.1.3 lib/neo4j/active_node/property.rb
neo4j-4.1.2 lib/neo4j/active_node/property.rb
neo4j-4.1.1 lib/neo4j/active_node/property.rb
neo4j-4.1.0 lib/neo4j/active_node/property.rb