cancancan-neo4j 1.0.3 → 1.2.0

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: fc6540031583b7f96c4143b5536b303ac76f0c21
4
- data.tar.gz: 3a1f772cec756e1ddf03039fc164a5a3814dc3a6
3
+ metadata.gz: c3b85a803fa71306a5981e5c4088db18f510fe9f
4
+ data.tar.gz: 6fc3de2b840ebd7bb26e979aed7956d1499231ba
5
5
  SHA512:
6
- metadata.gz: d81cd6bd8f6edceb1277134351fc34d9c1af8cedbed19c1bfcea2e41ea26dcc463b696d6bb8371f604c1300afd2237b9f338c798924233266f7aa534a91acf0d
7
- data.tar.gz: 593f125d2bdefa76bca27dcf00fd318a220c200df7990742cf5e84ce85140cf9f1ed8a54bfa306f3e4c8694c41932e91e747d8fc858534aa213657c507f3940b
6
+ metadata.gz: 4afcef739b4b5f44864656692d6da844b0bac734534e7ac18d8cc1355e9ccd00776d7d6292888eb9db5bebab46c59df0bd5a16ffaddfb39925886b2b7109230c
7
+ data.tar.gz: f3dd00a1d6fbbd64aeb9e249b73cd4a3e047f6c355c6d94b9807133dcaa4fa5ca91f5011faaeca4c85b00f9ac6cb958f53ac2c127ead78c047fb03fa66deeeb2
@@ -65,7 +65,8 @@ module CanCan
65
65
  def self.associations_conditions_match?(conditions, subject, base_class)
66
66
  return true if conditions.blank?
67
67
  conditions.all? do |association, conditions_hash|
68
- current_subject = subject.send(association)
68
+ rel_length = conditions_hash.delete(:rel_length)
69
+ current_subject = subject.send(association, rel_length: rel_length)
69
70
  return false unless current_subject
70
71
  current_model = base_class.associations[association].target_class
71
72
  all_conditions_match?(current_subject, conditions_hash, current_model)
@@ -17,7 +17,8 @@ module CanCanCan
17
17
  @options[:asso_conditions].each do |association, conditions|
18
18
  relationship = association_relation(association)
19
19
  associations_conditions, model_conditions = CypherConstructorHelper.bifurcate_conditions(conditions)
20
- current_path = append_path_to_conditions(relationship, model_conditions)
20
+ rel_length = associations_conditions.delete(:rel_length)
21
+ current_path = append_path_to_conditions(relationship, model_conditions, rel_length)
21
22
  append_model_conditions(model_conditions, relationship, current_path)
22
23
  append_association_conditions(associations_conditions, relationship)
23
24
  end
@@ -35,13 +36,14 @@ module CanCanCan
35
36
  @cypher_matches += asso_conditions_obj.cypher_matches
36
37
  end
37
38
 
38
- def append_path_to_conditions(relationship, model_conditions)
39
+ def append_path_to_conditions(relationship, model_conditions, rel_length)
39
40
  target_class = relationship.target_class
40
41
  model_attr_exists = model_conditions.any? do |key, _|
41
42
  !target_class.associations_keys.include?(key)
42
43
  end
43
44
  end_node = model_attr_exists ? CypherConstructorHelper.match_node_cypher(target_class) : '()'
44
- current_path = @options[:path] + relationship.arrow_cypher + end_node
45
+ arrow_cypher = relationship.arrow_cypher(nil, {}, false, false, rel_length)
46
+ current_path = @options[:path] + arrow_cypher + end_node
45
47
  if model_attr_exists
46
48
  append_matches(relationship)
47
49
  append_and_to_conditions_string
@@ -2,6 +2,6 @@ module CanCanCan
2
2
  end
3
3
  module CanCanCan
4
4
  module Neo4j
5
- VERSION = '1.0.3'.freeze
5
+ VERSION = '1.2.0'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancancan-neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amit Suryavanshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement