neo4j 5.2.2 → 5.2.3

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: 158a55b23a8fd93af668549d93b6ae70c78de131
4
- data.tar.gz: bf51075fa56f939a0f1121cf31f42358edf60ec5
3
+ metadata.gz: 6857fc3946f80bb498ef99f5e77ad04aae7780d2
4
+ data.tar.gz: 4544f2e9fe135d5d7c53d1122c13d14250d1ff32
5
5
  SHA512:
6
- metadata.gz: 12bf440770240a70cef138bb2760a97399f476b6d76f5a1bf03ea08184d421771d1152ecfae0d5791debd10c2f040f115a81761ad6b12936d366807caffef487
7
- data.tar.gz: c3bd8351338be1ab5e5d5f503a61338d88edab6b9dd4ec418347bb56935f09fa37b0f8d1c7a98b75e80335fca4d13b325ae6d36c8daec5ff45f3eca5a5f87c42
6
+ metadata.gz: 4aae1286a0007a42f95f55f0828cfc1e3ca9981510689df6d86f352c1aefea12a894c056631383367545be5aaf8e39e1c27d8dc2dc40e065d9020472283492e3
7
+ data.tar.gz: b495f1ae8518b65121f2c99a8bd2725a50ca7ea0fc60e416a84ef464b579ab9dce979aca5273f6fb758d1897d04ffeb0fbb211cacdba82f2f3f11b7d59ffce35
@@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased][unreleased]
7
7
 
8
+ ## [5.2.3] - 09-07-2015
9
+
10
+ Added bugfixes from 5.1.4 and 5.1.5 that were missed in earlier 5.2.x releases:
11
+ - `AssociationProxy` now responds to `serializable_hash` so that `include` can be used in `render json` in Rails controllers
12
+ - Fixed errors when trying to call `#{association}_ids=` on an unpersisted node with UUIDs or an array thereof.
13
+ - Removed extra Cypher query to replace relationships when working with unpersisted nodes and association=.
14
+ - Bug related to Rails reloading an app and returning nodes without first reinitializing models, resulting in CypherNodes.
15
+
8
16
  ## [5.2.2] - 09-06-2015
9
17
 
10
18
  ### Fixed
@@ -22,10 +30,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
22
30
  - Added `record_timestamps` configuration do default all `ActiveNode` and `ActiveRel` models to have `created_at` and `updated_at` timestamps (from #939, thanks @rebecca-eakins)
23
31
  - Added `timestamp_type` configuration to specify how timestamps should be stored (from #939, thanks @rebecca-eakins)
24
32
 
25
- ### Changed
26
- - Methods related to basic node and rel persistence (`save`, `create_model`, `_create_node`, others) were refactored to make the processes simpler, clearer, and slightly faster.
27
- - Unit test directory structure was rearranged to mirror the `lib` directory.
28
-
29
33
  ## [5.1.3] - 08-23-2015
30
34
 
31
35
  ### Fixed
@@ -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'
@@ -79,6 +79,10 @@ module Neo4j::ActiveNode
79
79
  target.public_send(method_name, *args, &block)
80
80
  end
81
81
 
82
+ def serializable_hash(options = {})
83
+ to_a.map { |record| record.serializable_hash(options) }
84
+ end
85
+
82
86
  private
83
87
 
84
88
  def target_for_missing_method(method_name)
@@ -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
@@ -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}')]
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '5.2.2'
2
+ VERSION = '5.2.3'
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.2
4
+ version: 5.2.3
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-06 00:00:00.000000000 Z
11
+ date: 2015-09-07 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