lib/neo4j/active_rel/property.rb in neo4j-3.0.0.rc.2 vs lib/neo4j/active_rel/property.rb in neo4j-3.0.0.rc.3

- old
+ new

@@ -17,18 +17,22 @@ def type self.class._type end + def initialize(attributes={}, options={}) + super(attributes, options) + + send_props(@relationship_props) unless @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.inject({}) do |relationship_props, key| - relationship_props[key] = attributes.delete(key) if key == :from_node || key == :to_node - - relationship_props + attributes.keys.each_with_object({}) do |key, relationship_props| + relationship_props[key] = attributes.delete(key) if [:from_node, :to_node].include?(key) end end %w[to_class from_class].each do |direction| define_method("#{direction}") { |argument| instance_variable_set("@#{direction}", argument) }