neo4j 5.2.1 → 5.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3be3813d47f9381c0d48f05745ec55c4c34fb24f
4
- data.tar.gz: ff011cb5224a4a44bb7d6debd3fc0e31682e0bbe
3
+ metadata.gz: 158a55b23a8fd93af668549d93b6ae70c78de131
4
+ data.tar.gz: bf51075fa56f939a0f1121cf31f42358edf60ec5
5
5
  SHA512:
6
- metadata.gz: f82b6f082d4ff9242ee2902fbe9b82d7fee8bffa8164d12eb6fd6c59e87c4bc911c202f807612853f49f83083665364c762f2a4884f1a1a18437509b9be289c9
7
- data.tar.gz: 074e0f957b1e73fb8e9a250de36dbcc17b3a54308c5b8a6df88303e69c0139082960457cbaf380f1f98e3fa901e89693696dd19f43666e8fb53acaaf5174240e
6
+ metadata.gz: 12bf440770240a70cef138bb2760a97399f476b6d76f5a1bf03ea08184d421771d1152ecfae0d5791debd10c2f040f115a81761ad6b12936d366807caffef487
7
+ data.tar.gz: c3bd8351338be1ab5e5d5f503a61338d88edab6b9dd4ec418347bb56935f09fa37b0f8d1c7a98b75e80335fca4d13b325ae6d36c8daec5ff45f3eca5a5f87c42
@@ -5,6 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [5.2.2] - 09-06-2015
9
+
10
+ ### Fixed
11
+ - Fixed setting of association(_id|_ids) on .create
12
+
8
13
  ## [5.2.1] - 09-04-2015
9
14
 
10
15
  ### Fixed
@@ -15,16 +15,33 @@ module Neo4j::ActiveNode
15
15
  def extract_association_attributes!(attributes)
16
16
  return unless contains_association?(attributes)
17
17
  attributes.each_with_object({}) do |(key, _), result|
18
- result[key] = attributes.delete(key) if self.association?(key)
18
+ result[key] = attributes.delete(key) if self.association_key?(key)
19
19
  end
20
20
  end
21
21
 
22
+ def association_key?(key)
23
+ association_method_keys.include?(key.to_sym)
24
+ end
25
+
22
26
  private
23
27
 
24
28
  def contains_association?(attributes)
25
29
  return false unless attributes
26
- attributes.each_key { |key| return true if associations_keys.include?(key) }
27
- false
30
+
31
+ attributes.each_key.any?(&method(:association_key?))
32
+ end
33
+
34
+ # All keys which could be association setter methods (including _id/_ids)
35
+ def association_method_keys
36
+ @association_method_keys ||=
37
+ associations_keys.map(&:to_sym) +
38
+ associations.values.map do |association|
39
+ if association.type == :has_one
40
+ "#{association.name}_id"
41
+ elsif association.type == :has_many
42
+ "#{association.name.to_s.singularize}_ids"
43
+ end.to_sym
44
+ end
28
45
  end
29
46
  end
30
47
  end
@@ -200,7 +200,7 @@ module Neo4j
200
200
 
201
201
  def _nodeify!(*args)
202
202
  other_nodes = [args].flatten!.map! do |arg|
203
- (arg.is_a?(Integer) || arg.is_a?(String)) ? @model.find_by(@model.id_property_name => arg) : arg
203
+ (arg.is_a?(Integer) || arg.is_a?(String)) ? @model.find_by(id: arg) : arg
204
204
  end.compact
205
205
 
206
206
  if @model && other_nodes.any? { |other_node| !other_node.class.mapped_label_names.include?(@model.mapped_label_name) }
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '5.2.1'
2
+ VERSION = '5.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter