neo4j 5.1.4 → 5.1.5

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: e193c59a2e941561b0764343ac801a0bf5a66001
4
- data.tar.gz: 2644ea2918f5d8e786bca66109715c8e86ff6946
3
+ metadata.gz: ee39f89dbeb6c4cbb84e138646bd14387a58a3e1
4
+ data.tar.gz: d3db82c3713b3be64ed389f9e249c95064d68491
5
5
  SHA512:
6
- metadata.gz: 546e57db09783f7d78aaea96a10860cd0561011fdc9adaacdfac26ec16880533d64f9fa09c4273b74290d3e9d015f6a4c57063b134fccabce605f8d32307fbcd
7
- data.tar.gz: 8e39420b43959a89c8e60e66360de0d714d02590e926f0c066f5b136b620ddccf293e8b104adedbf3a3d364ea67eae6b567ac6575d0afa545c4671139daf25f9
6
+ metadata.gz: 7761cd3c739a85440143ebf2c0063b797e874a83002639a6fecebc35b24f04013cfda55a798b344fbb5bbccfc85a287340773ca238f3373400cf2488e601ade4
7
+ data.tar.gz: 779db34b9d23809daec8ba37bee90ba6207869016f29928b52b7e1f1a5a6b687ff644d70c15ed14a86fcc747047d9b7062a87e57ea33fb0ef0589b7fd2bb0fac
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [5.1.5] = 08-26-2015
9
+
10
+ ### Fixed
11
+ - Fixed errors when trying to call `#{association}_ids=` on an unpersisted node with UUIDs or an array thereof.
12
+ - Removed extra Cypher query to replace relationships when working with unpersisted nodes and `association=`.
13
+ - Bug related to Rails reloading an app and returning nodes without first reinitializing models, resulting in CypherNodes.
14
+
8
15
  ## [5.1.4] - 08-24-2015
9
16
 
10
17
  ### Fixed
data/Gemfile CHANGED
@@ -19,4 +19,5 @@ group 'test' do
19
19
  gem 'overcommit'
20
20
  gem 'colored'
21
21
  gem 'dotenv'
22
+ gem 'timecop'
22
23
  end
data/lib/neo4j.rb CHANGED
@@ -60,6 +60,7 @@ require 'neo4j/active_node/query/query_proxy_enumerable'
60
60
  require 'neo4j/active_node/query/query_proxy_find_in_batches'
61
61
  require 'neo4j/active_node/query/query_proxy_eager_loading'
62
62
  require 'neo4j/active_node/query/query_proxy_link'
63
+ require 'neo4j/active_node/labels/reloading'
63
64
  require 'neo4j/active_node/labels'
64
65
  require 'neo4j/active_node/id_property/accessor'
65
66
  require 'neo4j/active_node/id_property'
@@ -3,6 +3,7 @@ module Neo4j
3
3
  # Provides a mapping between neo4j labels and Ruby classes
4
4
  module Labels
5
5
  extend ActiveSupport::Concern
6
+ include Neo4j::ActiveNode::Labels::Reloading
6
7
 
7
8
  WRAPPED_CLASSES = []
8
9
  MODELS_FOR_LABELS_CACHE = {}
@@ -75,17 +76,9 @@ module Neo4j
75
76
  WRAPPED_CLASSES.clear
76
77
  end
77
78
 
78
- protected
79
-
80
79
  module ClassMethods
81
80
  include Neo4j::ActiveNode::QueryMethods
82
81
 
83
- def before_remove_const
84
- associations.each_value(&:queue_model_refresh!)
85
- MODELS_FOR_LABELS_CACHE.clear
86
- WRAPPED_CLASSES.clear
87
- end
88
-
89
82
  # Returns the object with the specified neo4j id.
90
83
  # @param [String,Integer] id of node to find
91
84
  def find(id)
@@ -0,0 +1,21 @@
1
+ module Neo4j::ActiveNode::Labels
2
+ module Reloading
3
+ extend ActiveSupport::Concern
4
+
5
+ MODELS_TO_RELOAD = []
6
+
7
+ def self.reload_models!
8
+ MODELS_TO_RELOAD.each(&:constantize)
9
+ MODELS_TO_RELOAD.clear
10
+ end
11
+
12
+ module ClassMethods
13
+ def before_remove_const
14
+ associations.each_value(&:queue_model_refresh!)
15
+ MODELS_FOR_LABELS_CACHE.clear
16
+ WRAPPED_CLASSES.each { |c| MODELS_TO_RELOAD << c.name }
17
+ WRAPPED_CLASSES.clear
18
+ end
19
+ end
20
+ end
21
+ end
@@ -164,6 +164,7 @@ module Neo4j
164
164
 
165
165
  # Deletes the relationships between all nodes for the last step in the QueryProxy chain. Executed in the database, callbacks will not be run.
166
166
  def delete_all_rels
167
+ return unless start_object && start_object._persisted_obj
167
168
  self.query.delete(rel_var).exec
168
169
  end
169
170
 
@@ -40,8 +40,10 @@ module Neo4j
40
40
  end
41
41
 
42
42
  def save_and_associate_node(association_name, node, operator)
43
- node.save if node.changed? || !node.persisted?
44
- fail "Unable to defer node persistence, could not save #{node.inspect}" unless node.persisted?
43
+ if node.respond_to?(:changed?)
44
+ node.save if node.changed? || !node.persisted?
45
+ fail "Unable to defer node persistence, could not save #{node.inspect}" unless node.persisted?
46
+ end
45
47
  operator == :<< ? send(association_name).send(operator, node) : send(:"#{association_name}=", node)
46
48
  end
47
49
  end
data/lib/neo4j/railtie.rb CHANGED
@@ -5,6 +5,12 @@ module Neo4j
5
5
  class Railtie < ::Rails::Railtie
6
6
  config.neo4j = ActiveSupport::OrderedOptions.new
7
7
 
8
+ if const_defined?(:ActionDispatch)
9
+ ActionDispatch::Reloader.to_prepare do
10
+ Neo4j::ActiveNode::Labels::Reloading.reload_models!
11
+ end
12
+ end
13
+
8
14
  # Add ActiveModel translations to the I18n load_path
9
15
  initializer 'i18n' do
10
16
  config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'locales', '*.{rb,yml}')]
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '5.1.4'
2
+ VERSION = '5.1.5'
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.1.4
4
+ version: 5.1.5
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-08-24 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -236,6 +236,7 @@ files:
236
236
  - lib/neo4j/active_node/id_property/accessor.rb
237
237
  - lib/neo4j/active_node/initialize.rb
238
238
  - lib/neo4j/active_node/labels.rb
239
+ - lib/neo4j/active_node/labels/reloading.rb
239
240
  - lib/neo4j/active_node/node_wrapper.rb
240
241
  - lib/neo4j/active_node/orm_adapter.rb
241
242
  - lib/neo4j/active_node/persistence.rb
@@ -322,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
323
  version: '0'
323
324
  requirements: []
324
325
  rubyforge_project: neo4j
325
- rubygems_version: 2.4.5
326
+ rubygems_version: 2.4.6
326
327
  signing_key:
327
328
  specification_version: 4
328
329
  summary: A graph database for Ruby