neo4j 8.0.7 → 8.0.8

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: c41a89a3f3b4bf54c88ae93fc75658adff53e757
4
- data.tar.gz: 4bc73253d39f9315beb25776d71584e994380624
3
+ metadata.gz: e4e4e1f41a10a75f45e91874eafeafce3bdab8c7
4
+ data.tar.gz: 67f98d425120d37961028c8ca3f548cd56eda227
5
5
  SHA512:
6
- metadata.gz: 2ff1e5792b93e749d7d9c57058a0f7fd87ad4f000da2e7627db681dfdd6a0872dbea0135153ed6a197dd51d11f043a5dcf4d842a524296b6c9d6f60441996a4d
7
- data.tar.gz: db72e9266b1a14c0d35fd64614a86bd1d649523d7c30e5c807f0ebad407592922eeef95ecc40390cb2d8a9806e728007005cb30821f853f1735c2aabc2ad3065
6
+ metadata.gz: 33842d045636bfcfe4592157d9d634841346c8a02d22ebd3312549d97a767365d6ea645ad58cc4820a6316b85a74d85ae040703f5e07c476b787f46039377c73
7
+ data.tar.gz: 60f12d641a8c464b1a075075b2d7adf6d595ab1d4d1b6d25d53339c35f3ba0f87f702508ba49672e8104baf0cc9744d51dfa2931b56e823780864f6f571c5e4e
data/CHANGELOG.md CHANGED
@@ -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
+ ## [8.0.8] 2016-02-27
7
+
8
+ ### Fixed
9
+
10
+ - Performance and response consistency improvements to `exists?` methods
11
+
6
12
  ## [8.0.7] 2016-02-24
7
13
 
8
14
  ### Fixed
@@ -94,12 +94,13 @@ module Neo4j
94
94
  end
95
95
 
96
96
  def exists?(node_condition = nil, target = nil)
97
- unless node_condition.is_a?(Integer) || node_condition.is_a?(Hash) || node_condition.nil?
98
- fail(Neo4j::InvalidParameterError, ':exists? only accepts neo_ids')
97
+ unless [Integer, Fixnum, String, Hash, NilClass].include?(node_condition.class)
98
+ fail(Neo4j::InvalidParameterError, ':exists? only accepts ids or conditions')
99
99
  end
100
100
  query_with_target(target) do |var|
101
101
  start_q = exists_query_start(node_condition, var)
102
- start_q.query.reorder.return("COUNT(#{var}) AS count").first.count > 0
102
+ result = start_q.query.reorder.return("ID(#{var}) AS proof_of_life LIMIT 1").first
103
+ !!result
103
104
  end
104
105
  end
105
106
 
@@ -284,6 +285,8 @@ module Neo4j
284
285
  self.where("ID(#{target}) = {exists_condition}").params(exists_condition: condition)
285
286
  when Hash
286
287
  self.where(condition.keys.first => condition.values.first)
288
+ when String
289
+ self.where(model.primary_key => condition)
287
290
  else
288
291
  self
289
292
  end
@@ -2,12 +2,13 @@ module Neo4j
2
2
  module ActiveNode
3
3
  module QueryMethods
4
4
  def exists?(node_condition = nil)
5
- unless node_condition.is_a?(Integer) || node_condition.is_a?(Hash) || node_condition.nil?
5
+ unless [Integer, Fixnum, String, Hash, NilClass].include?(node_condition.class)
6
6
  fail(Neo4j::InvalidParameterError, ':exists? only accepts ids or conditions')
7
7
  end
8
8
  query_start = exists_query_start(node_condition)
9
9
  start_q = query_start.respond_to?(:query_as) ? query_start.query_as(:n) : query_start
10
- start_q.return('COUNT(n) AS count').first.count > 0
10
+ result = start_q.return('ID(n) AS proof_of_life LIMIT 1').first
11
+ !!result
11
12
  end
12
13
 
13
14
  # Returns the first node of this class, sorted by ID. Note that this may not be the first node created since Neo4j recycles IDs.
@@ -54,6 +55,8 @@ module Neo4j
54
55
  case node_condition
55
56
  when Integer
56
57
  self.query_as(:n).where('ID(n)' => node_condition)
58
+ when String
59
+ self.query_as(:n).where(n: {primary_key => node_condition})
57
60
  when Hash
58
61
  self.where(node_condition.keys.first => node_condition.values.first)
59
62
  else
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '8.0.7'
2
+ VERSION = '8.0.8'
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: 8.0.7
4
+ version: 8.0.8
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: 2017-02-24 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -210,10 +210,8 @@ dependencies:
210
210
  - - "~>"
211
211
  - !ruby/object:Gem::Version
212
212
  version: 0.39.0
213
- description: 'A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack
214
- frameworks heavily inspired by ActiveRecord.
215
-
216
- '
213
+ description: |
214
+ A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack frameworks heavily inspired by ActiveRecord.
217
215
  email: andreas.ronge@gmail.com, public@brian-underwood.codes, chris@subvertallmedia.com
218
216
  executables:
219
217
  - neo4j-jars
@@ -367,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
365
  version: '0'
368
366
  requirements: []
369
367
  rubyforge_project: neo4j
370
- rubygems_version: 2.6.8
368
+ rubygems_version: 2.4.5.1
371
369
  signing_key:
372
370
  specification_version: 4
373
371
  summary: A graph database for Ruby