neo4j 9.5.0 → 9.5.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
  SHA256:
3
- metadata.gz: 1d29f60a9c7d8ae6a2415d1ff37d4bad444a21853dbce515c95824d2a83540d0
4
- data.tar.gz: c1bb5780fa1bde00cbbd3fbff425190012a2de19a0a0b22f836f5e6fc10ffb3b
3
+ metadata.gz: '0364211168add80fe38bd3274825f155430521e2f6fb2e7228dad3e49aa057ac'
4
+ data.tar.gz: c12278922c2b982334a564b85bf572a6db59fbd9c8ed7b520823a267c6d82562
5
5
  SHA512:
6
- metadata.gz: e67d937270cfb963b8e3ee4326c0946bbff1c4d21290e54def9eeeec10c5bd258df93d8f05f3241f94c56401a136fc4588d79e198a5d0bfdecf170bb1e3f0683
7
- data.tar.gz: 95756152b26bfd067535b680040827872de54fc89e87f1f6f38053b1fa7df9671bb4e20aceb9d4de07695b0573e946765f2568da0029fff2ba71715f11ac4fb9
6
+ metadata.gz: e063079054524c0843e720158e0af61fbb2b9c4121d38fac4fd1eea3648b95af196f63d8c3585491d4518535f398dde6b733a55baa2f0798dc8bf7927cc821b2
7
+ data.tar.gz: e7822e8abf2eb73bce2011bbbb016f60ace21bc93ddaf7e1db89f3e9a3c0614e49fbc89f14990bf2f9f63fddbe5a3a54371b7ef6769737eea85735d304c8d8c6
@@ -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.5.2] 2019-08-06
7
+
8
+ ## Fixed
9
+
10
+ - Made neo4j_community gem a development dependency rather than a runtime dependency.
11
+
12
+ ## [9.5.1] 2019-07-31
13
+
14
+ ## Fixed
15
+
16
+ - Reverse has_one relationships with ActiveRel (thanks @amitsuryavanshi / #1560)
17
+
6
18
  ## [9.5.0] 2019-06-17
7
19
 
8
20
  ## Added
@@ -229,6 +229,23 @@ module Neo4j::ActiveNode
229
229
  end
230
230
  end
231
231
 
232
+ def delete_has_one_rel(active_rel, direction, target_class)
233
+ rel = active_rel_corresponding_rel(active_rel, direction, target_class)
234
+ delete_rel(rel.last) if rel && rel.last.type == :has_one
235
+ end
236
+
237
+ def delete_rel(rel)
238
+ send("#{rel.name}=", nil)
239
+ association_proxy_cache.clear
240
+ end
241
+
242
+ def active_rel_corresponding_rel(active_rel, direction, target_class)
243
+ self.class.associations.find do |_key, assoc|
244
+ assoc.relationship_class_name == active_rel.class.name ||
245
+ (assoc.relationship_type == active_rel.type.to_sym && assoc.target_class == target_class && assoc.direction == direction)
246
+ end
247
+ end
248
+
232
249
  private
233
250
 
234
251
  def fresh_association_proxy(name, options = {}, result_cache_proc = nil)
@@ -10,11 +10,13 @@ module Neo4j::ActiveNode
10
10
 
11
11
  def delete_reverse_relationship(association)
12
12
  reverse_assoc = reverse_association(association)
13
- self.send("#{reverse_assoc.name}=", nil) if reverse_assoc && reverse_assoc.type == :has_one
13
+ delete_rel(reverse_assoc) if reverse_assoc && reverse_assoc.type == :has_one
14
14
  end
15
15
 
16
16
  def reverse_association(association)
17
- reverse_assoc = self.class.associations.find { |_key, assoc| association.inverse_of?(assoc) }
17
+ reverse_assoc = self.class.associations.find do |_key, assoc|
18
+ association.inverse_of?(assoc) || assoc.inverse_of?(association)
19
+ end
18
20
  reverse_assoc && reverse_assoc.last
19
21
  end
20
22
  end
@@ -45,12 +45,18 @@ module Neo4j::ActiveRel
45
45
 
46
46
  def create_model
47
47
  validate_node_classes!
48
+ delete_has_one_rel
48
49
  rel = _create_rel
49
50
  return self unless rel.respond_to?(:props)
50
51
  init_on_load(rel, from_node, to_node, @rel_type)
51
52
  true
52
53
  end
53
54
 
55
+ def delete_has_one_rel
56
+ to_node.delete_has_one_rel(self, :in, from_node.class) if to_node.persisted?
57
+ from_node.delete_has_one_rel(self, :out, to_node.class) if from_node.persisted?
58
+ end
59
+
54
60
  def query_as(var)
55
61
  # This should query based on the nodes, not the rel neo_id, I think
56
62
  # Also, picky point: Should the var be `n`?
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '9.5.0'
2
+ VERSION = '9.5.2'
3
3
  end
@@ -36,12 +36,12 @@ DESCRIPTION
36
36
  s.add_dependency('activemodel', '>= 4.0')
37
37
  s.add_dependency('activesupport', '>= 4.0')
38
38
  s.add_dependency('i18n', '!= 1.3.0') # version 1.3.0 introduced a bug with `symbolize_key`
39
- s.add_dependency('neo4j-community', '~> 2.0') if RUBY_PLATFORM =~ /java/
40
39
  s.add_dependency('neo4j-core', '>= 9.0.0')
41
40
  s.add_dependency('orm_adapter', '~> 0.5.0')
42
41
  s.add_development_dependency('guard')
43
42
  s.add_development_dependency('guard-rspec')
44
43
  s.add_development_dependency('guard-rubocop')
44
+ s.add_development_dependency('neo4j-community', '~> 2.0') if RUBY_PLATFORM =~ /java/
45
45
  s.add_development_dependency('neo4j-rake_tasks', '>= 0.3.0')
46
46
  s.add_development_dependency('os')
47
47
  s.add_development_dependency('pry')
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: 9.5.0
4
+ version: 9.5.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: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -222,7 +222,7 @@ dependencies:
222
222
  version: '0'
223
223
  description: 'A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
224
224
 
225
- '
225
+ '
226
226
  email: andreas.ronge@gmail.com, public@brian-underwood.codes, chris@subvertallmedia.com
227
227
  executables:
228
228
  - neo4j-jars
@@ -382,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
382
382
  version: '0'
383
383
  requirements: []
384
384
  rubyforge_project: neo4j
385
- rubygems_version: 2.7.8
385
+ rubygems_version: 2.7.6
386
386
  signing_key:
387
387
  specification_version: 4
388
388
  summary: A graph database for Ruby