neo4j 9.1.8 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/neo4j/active_node/has_n.rb +18 -6
- data/lib/neo4j/active_node/has_n/association.rb +3 -1
- data/lib/neo4j/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c0f2fd54679230595111f53cebdbf903a1438e
|
4
|
+
data.tar.gz: fe2f94f8ab2da07e40060260c7cf7c527b978649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6514e9e4161b5c6816afafa79b7d99a2104ff192fca8ee8d2bc344012fec68c8a531dcf745c1f8f6c80bcb9f98cc0204d66282db430a14b79d2e3b46b8ac42d
|
7
|
+
data.tar.gz: 51f664641fb807f2fe7406cd939dc90b0b0d92dd8e99434fbec4a347c85fd755f3314063dd271ef8c91422656aa0f19613af82e897bb5a223b075ad4563b0b09
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@ 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
|
+
## [9.2.0] 2018-03-27
|
7
|
+
|
8
|
+
## Added
|
9
|
+
|
10
|
+
- Ability to create association with `labels: false` by default (thanks @thefliik / see #1485)
|
11
|
+
|
12
|
+
## [9.1.8] 2018-03-27
|
13
|
+
|
14
|
+
## Fixed
|
15
|
+
|
16
|
+
- Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
|
17
|
+
|
6
18
|
## [9.1.8] 2018-03-27
|
7
19
|
|
8
20
|
## Fixed
|
@@ -364,7 +364,7 @@ module Neo4j::ActiveNode
|
|
364
364
|
name = name.to_sym
|
365
365
|
build_association(:has_many, direction, name, options)
|
366
366
|
|
367
|
-
define_has_many_methods(name)
|
367
|
+
define_has_many_methods(name, options)
|
368
368
|
end
|
369
369
|
|
370
370
|
# For defining an "has one" association on a model. This defines a set of methods on
|
@@ -381,17 +381,21 @@ module Neo4j::ActiveNode
|
|
381
381
|
name = name.to_sym
|
382
382
|
build_association(:has_one, direction, name, options)
|
383
383
|
|
384
|
-
define_has_one_methods(name)
|
384
|
+
define_has_one_methods(name, options)
|
385
385
|
end
|
386
386
|
|
387
387
|
private
|
388
388
|
|
389
|
-
def define_has_many_methods(name)
|
389
|
+
def define_has_many_methods(name, association_options)
|
390
|
+
default_options = association_options.slice(:labels)
|
391
|
+
|
390
392
|
define_method(name) do |node = nil, rel = nil, options = {}|
|
391
393
|
# return [].freeze unless self._persisted_obj
|
392
394
|
|
393
395
|
options, node = node, nil if node.is_a?(Hash)
|
394
396
|
|
397
|
+
options = default_options.merge(options)
|
398
|
+
|
395
399
|
association_proxy(name, {node: node, rel: rel, source_object: self, labels: options[:labels]}.merge!(options))
|
396
400
|
end
|
397
401
|
|
@@ -402,6 +406,8 @@ module Neo4j::ActiveNode
|
|
402
406
|
define_class_method(name) do |node = nil, rel = nil, options = {}|
|
403
407
|
options, node = node, nil if node.is_a?(Hash)
|
404
408
|
|
409
|
+
options = default_options.merge(options)
|
410
|
+
|
405
411
|
association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
|
406
412
|
end
|
407
413
|
end
|
@@ -435,8 +441,10 @@ module Neo4j::ActiveNode
|
|
435
441
|
define_method(method_name, block) unless method_defined?(method_name)
|
436
442
|
end
|
437
443
|
|
438
|
-
def define_has_one_methods(name)
|
439
|
-
|
444
|
+
def define_has_one_methods(name, association_options)
|
445
|
+
default_options = association_options.slice(:labels)
|
446
|
+
|
447
|
+
define_has_one_getter(name, default_options)
|
440
448
|
|
441
449
|
define_has_one_setter(name)
|
442
450
|
|
@@ -445,6 +453,8 @@ module Neo4j::ActiveNode
|
|
445
453
|
define_class_method(name) do |node = nil, rel = nil, options = {}|
|
446
454
|
options, node = node, nil if node.is_a?(Hash)
|
447
455
|
|
456
|
+
options = default_options.merge(options)
|
457
|
+
|
448
458
|
association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
|
449
459
|
end
|
450
460
|
end
|
@@ -463,10 +473,12 @@ module Neo4j::ActiveNode
|
|
463
473
|
end
|
464
474
|
end
|
465
475
|
|
466
|
-
def define_has_one_getter(name)
|
476
|
+
def define_has_one_getter(name, default_options)
|
467
477
|
define_method(name) do |node = nil, rel = nil, options = {}|
|
468
478
|
options, node = node, nil if node.is_a?(Hash)
|
469
479
|
|
480
|
+
options = default_options.merge(options)
|
481
|
+
|
470
482
|
association_proxy = association_proxy(name, {node: node, rel: rel}.merge!(options))
|
471
483
|
|
472
484
|
# Return all results if options[:chainable] == true or a variable-length relationship length was given
|
@@ -203,7 +203,9 @@ module Neo4j
|
|
203
203
|
check_valid_type_and_dir(type, direction)
|
204
204
|
end
|
205
205
|
|
206
|
-
|
206
|
+
# the ":labels" option is not used by the association per-say.
|
207
|
+
# Instead, if provided,it is used by the association getter as a default getter options argument
|
208
|
+
VALID_ASSOCIATION_OPTION_KEYS = [:type, :origin, :model_class, :rel_class, :dependent, :before, :after, :unique, :labels]
|
207
209
|
|
208
210
|
def validate_association_options!(_association_name, options)
|
209
211
|
ClassArguments.validate_argument!(options[:model_class], 'model_class')
|
data/lib/neo4j/version.rb
CHANGED