neo4j 7.0.9 → 7.0.10

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: 532f0d8e1f5a6d684b45075eab7d476d25880151
4
- data.tar.gz: 40946691bba97d4363c71d621d3035248637fcb0
3
+ metadata.gz: ef009c057d36a788a10a49c2879e59a4ee57016a
4
+ data.tar.gz: 50b2b6437ad96458f9ea23905f573a5c07bdff98
5
5
  SHA512:
6
- metadata.gz: 701f7337c59bbaf7f37b49cff159b9ccaaeeaca50cb26fba3924ad66978f89f57cad8c169bcf5f87575a177244063e3d411dd088a26f2569a6f313608dd91287
7
- data.tar.gz: 4b26c825000b47ce613c8eb1619f57117d38b1c032cf1cbb030d93bd0f411966bdb5497eb908a64bed76bb167d40e9cbcc9a7828ba1641b6a2b2f3232fb7f16c
6
+ metadata.gz: 5d6568b27eab7758049ef41a8c2eeeaed7aa11f1da5cf7217ffa97a1ee3685e63c0e7a2a07b16f51e62bee812d33a37a923f8f2fee2171cfec15b7ea4247749a
7
+ data.tar.gz: fc0bf2a7c8f30f09746a4a8af37e9827c5920d3b6f94e0d02f22e0621944b987cdf39d6a4a94680d2252f0f19aa7c3278649a65f9e2d0cf7b97e0b66109ca34f
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [7.0.10] - 06-07-2016
7
+
8
+ ### Fixed
9
+
10
+ - Calling `.create` on associations shouldn't involve extra queries (thanks for the report from rahulmeena13 / see #1216)
11
+
6
12
  ## [7.0.9] - 05-30-2016
7
13
 
8
14
  ### Fixed
@@ -8,11 +8,11 @@ module Neo4j::ActiveNode
8
8
  # It uses a QueryProxy to get results
9
9
  # But also caches results and can have results cached on it
10
10
  class AssociationProxy
11
- def initialize(query_proxy, deferred_objects = [], cached_result = nil)
11
+ def initialize(query_proxy, deferred_objects = [], result_cache_proc = nil)
12
12
  @query_proxy = query_proxy
13
13
  @deferred_objects = deferred_objects
14
14
 
15
- cache_result(cached_result)
15
+ @result_cache_proc = result_cache_proc
16
16
 
17
17
  # Represents the thing which can be enumerated
18
18
  # default to @query_proxy, but will be set to
@@ -88,7 +88,11 @@ module Neo4j::ActiveNode
88
88
  end
89
89
 
90
90
  def cache_query_proxy_result
91
- @query_proxy.to_a.tap { |result| cache_result(result) }
91
+ (result_cache_proc_cache || @query_proxy).to_a.tap { |result| cache_result(result) }
92
+ end
93
+
94
+ def result_cache_proc_cache
95
+ @result_cache_proc_cache ||= @result_cache_proc.call if @result_cache_proc
92
96
  end
93
97
 
94
98
  def clear_cache_result
@@ -105,7 +109,7 @@ module Neo4j::ActiveNode
105
109
  @query_proxy.public_send(:replace_with, *args)
106
110
  end
107
111
 
108
- QUERY_PROXY_METHODS = [:<<, :delete]
112
+ QUERY_PROXY_METHODS = [:<<, :delete, :create]
109
113
  CACHED_RESULT_METHODS = []
110
114
 
111
115
  def method_missing(method_name, *args, &block)
@@ -171,10 +175,10 @@ module Neo4j::ActiveNode
171
175
  hash = association_proxy_hash(name, options)
172
176
  association_proxy_cache_fetch(hash) do
173
177
  if result_cache = self.instance_variable_get('@source_proxy_result_cache')
174
- result_by_previous_id = previous_proxy_results_by_previous_id(result_cache, name)
175
-
178
+ cache = nil
176
179
  result_cache.inject(nil) do |proxy_to_return, object|
177
- proxy = fresh_association_proxy(name, options.merge(start_object: object), result_by_previous_id[object.neo_id])
180
+ proxy = fresh_association_proxy(name, options.merge(start_object: object),
181
+ proc { (cache ||= previous_proxy_results_by_previous_id(result_cache, name))[object.neo_id] })
178
182
 
179
183
  object.association_proxy_cache[hash] = proxy
180
184
 
@@ -188,8 +192,8 @@ module Neo4j::ActiveNode
188
192
 
189
193
  private
190
194
 
191
- def fresh_association_proxy(name, options = {}, cached_result = nil)
192
- AssociationProxy.new(association_query_proxy(name, options), deferred_nodes_for_association(name), cached_result)
195
+ def fresh_association_proxy(name, options = {}, result_cache_proc = nil)
196
+ AssociationProxy.new(association_query_proxy(name, options), deferred_nodes_for_association(name), result_cache_proc)
193
197
  end
194
198
 
195
199
  def previous_proxy_results_by_previous_id(result_cache, association_name)
@@ -199,7 +199,7 @@ module Neo4j
199
199
  self.to_a[index]
200
200
  end
201
201
 
202
- def create(other_nodes, properties)
202
+ def create(other_nodes, properties = {})
203
203
  fail 'Can only create relationships on associations' if !@association
204
204
  other_nodes = _nodeify!(*other_nodes)
205
205
 
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '7.0.9'
2
+ VERSION = '7.0.10'
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: 7.0.9
4
+ version: 7.0.10
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: 2016-05-30 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter