cancancan 3.0.1 → 3.0.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: ec5d008dea72d99ee804c69a710c9b474e39c8085cf23317cfa031f0ef3acd95
4
- data.tar.gz: dfc2e52da361d4405ced63b2a229dbb34e80885abebad71bb531df4999d25fa1
3
+ metadata.gz: f0fb1ea8821029ab1e070299caac458325635748b3051e1f08999176ec81e29d
4
+ data.tar.gz: 20a2d023ab68fdf8392d57cc0d32a95d5d904d2bac67c60850d8339524e48de6
5
5
  SHA512:
6
- metadata.gz: 43d51d793d5dad4d3e0b21f106c09ff3abcbb8862bbb6377b479b9748191af470bdd45d6005126a5622626c4d3a16e7f3242889a5ddf2a6da1b74c3f8f553edf
7
- data.tar.gz: ad7df527d7267c980a229a81fde2d6e5d03129260786f808ffc8c0d4016db7d29d9fd275e18a608c7cf1d474108638d4e3bdf4ac2ab56c18bc946270f39f830e
6
+ metadata.gz: 983f4b45a5c32972bca59adb1a0a2591352ba571fb3d95a13c91c40b719828507611ab7c3695ff94bcc07ae8599cac95d1bab8e4bcbad9fd9250bc20e22d9b9c
7
+ data.tar.gz: 626e5e82e569b68383eb63a605983f92276540f3a20abd35e1fb1a79876880a8b533296382ddef27caa9e7cad3fa28bdd885dd77e87680b32aa70cc38592c256
@@ -31,7 +31,7 @@ module CanCan
31
31
  raise WrongAssociationName, "Association '#{key}' not defined in model '#{model_class.name}'"
32
32
  end
33
33
 
34
- if reflection.options[:through].present?
34
+ if normalizable_association? reflection
35
35
  key = reflection.options[:through]
36
36
  value = { reflection.source_reflection_name => value }
37
37
  reflection = model_class.reflect_on_association(key)
@@ -39,6 +39,10 @@ module CanCan
39
39
 
40
40
  { key => normalize_conditions(reflection.klass.name.constantize, value) }
41
41
  end
42
+
43
+ def normalizable_association?(reflection)
44
+ reflection.options[:through].present? && !reflection.options[:source_type].present?
45
+ end
42
46
  end
43
47
  end
44
48
  end
@@ -34,11 +34,13 @@ module CanCan
34
34
  def inspect
35
35
  repr = "#<#{self.class.name}"
36
36
  repr += "#{@base_behavior ? 'can' : 'cannot'} #{@actions.inspect}, #{@subjects.inspect}, #{@attributes.inspect}"
37
- repr += if with_scope?
38
- ", #{@conditions.where_values_hash}"
39
- elsif [Hash, String].include?(@conditions.class)
40
- ", #{@conditions.inspect}"
41
- end
37
+
38
+ if with_scope?
39
+ repr += ", #{@conditions.where_values_hash}"
40
+ elsif [Hash, String].include?(@conditions.class)
41
+ repr += ", #{@conditions.inspect}"
42
+ end
43
+
42
44
  repr + '>'
43
45
  end
44
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CanCan
4
- VERSION = '3.0.1'.freeze
4
+ VERSION = '3.0.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancancan
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi (Renuo AG)
@@ -11,28 +11,28 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-04-16 00:00:00.000000000 Z
14
+ date: 2020-01-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: appraisal
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - "~>"
21
- - !ruby/object:Gem::Version
22
- version: '2.0'
23
20
  - - ">="
24
21
  - !ruby/object:Gem::Version
25
22
  version: 2.0.0
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
26
  type: :development
27
27
  prerelease: false
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '2.0'
33
30
  - - ">="
34
31
  - !ruby/object:Gem::Version
35
32
  version: 2.0.0
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '2.0'
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
38
  requirement: !ruby/object:Gem::Requirement
@@ -71,22 +71,22 @@ dependencies:
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '3.2'
77
74
  - - ">="
78
75
  - !ruby/object:Gem::Version
79
76
  version: 3.2.0
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '3.2'
80
80
  type: :development
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: '3.2'
87
84
  - - ">="
88
85
  - !ruby/object:Gem::Version
89
86
  version: 3.2.0
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.2'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rubocop
92
92
  requirement: !ruby/object:Gem::Requirement
@@ -161,8 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.7.6
164
+ rubygems_version: 3.0.6
166
165
  signing_key:
167
166
  specification_version: 4
168
167
  summary: Simple authorization solution for Rails.