cancancan 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a89f93b55a85e54a08313de3a4cb8bad1886b3a1325c39953a8667fd58734be9
4
- data.tar.gz: fdbf729ba98180067f749415815005bb2362e84f3f04014248b88f7974bf3982
3
+ metadata.gz: 2fc535d60bc86d927de5d440cc48a0538756260629c5c63b55249028dc0f5750
4
+ data.tar.gz: c6122db4d687d6d8da0b9732ba4b76ee5bd037ce698f21ea77fd228676223aaf
5
5
  SHA512:
6
- metadata.gz: 3ae7721feae9b7dfc2e411878bb600f08cf8edfbe42a01989b6c09ad162443714643898129ad15ca24b5f8d1bf30fb916016eac7baf466671a18a0f292f69f5d
7
- data.tar.gz: '086c7fdf46ab6caa794c425681557469deffb8038f88fc7aba00e1a361fe8dd5b85caaa18884916e5ce908c7e6efec0f02b3b337a1405159b12d785ea2dc6f5d'
6
+ metadata.gz: 72d2feaca94739a094018d15719bc94098a0bf2b9fd686c6c92ccee83b03e767533f2786d5987d89fc98129b29a6737ec8f05516e2556396f14a9b2c89c94c65
7
+ data.tar.gz: 2e70df7d32570fbc601aab8caa83b6bb5b78249b7db6ba436da1cdaf32b6db1e0003fa9267e11060f21675d32fd0cc2e44b807c6cf2850d86295be5d41ae3df0
data/cancancan.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Alessandro Rodi (Renuo AG)', 'Bryan Rite', 'Ryan Bates', 'Richard Wilson']
11
11
  s.email = 'alessandro.rodi@renuo.ch'
12
12
  s.homepage = 'https://github.com/CanCanCommunity/cancancan'
13
- s.metadata = { 'changelog_uri' => 'https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md',
13
+ s.metadata = { 'changelog_uri' => 'https://github.com/CanCanCommunity/cancancan/blob/main/CHANGELOG.md',
14
14
  'funding_uri' => 'https://github.com/sponsors/coorasse' }
15
15
  s.summary = 'Simple authorization solution for Rails.'
16
16
  s.description = 'Simple authorization solution for Rails. All permissions are stored in a single location.'
@@ -105,8 +105,13 @@ module CanCan
105
105
  end
106
106
 
107
107
  # Like Active Record with a relation as condition value: the selected column, or the primary key, is matched.
108
+ # A record matches the primary key only when it is an instance of the model of the relation, so that a record
109
+ # of another model with the same id, e.g. through a polymorphic association, does not match.
108
110
  def relation_match?(attribute, relation)
109
- relation.where((relation.select_values.first || relation.primary_key) => attribute).exists?
111
+ column = relation.select_values.first
112
+ return false if column.nil? && attribute.is_a?(ActiveRecord::Base) && !attribute.is_a?(relation.klass)
113
+
114
+ relation.where((column || relation.primary_key) => attribute).exists?
110
115
  end
111
116
 
112
117
  def hash_condition_match?(attribute, value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CanCan
4
- VERSION = '3.7.0'.freeze
4
+ VERSION = '3.7.1'.freeze
5
5
  end
@@ -27,6 +27,6 @@ class Ability
27
27
  # can :update, Article, published: true
28
28
  #
29
29
  # See the wiki for details:
30
- # https://github.com/CanCanCommunity/cancancan/blob/develop/docs/define_check_abilities.md
30
+ # https://github.com/CanCanCommunity/cancancan/blob/main/docs/define_check_abilities.md
31
31
  end
32
32
  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.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi (Renuo AG)
@@ -144,7 +144,7 @@ homepage: https://github.com/CanCanCommunity/cancancan
144
144
  licenses:
145
145
  - MIT
146
146
  metadata:
147
- changelog_uri: https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md
147
+ changelog_uri: https://github.com/CanCanCommunity/cancancan/blob/main/CHANGELOG.md
148
148
  funding_uri: https://github.com/sponsors/coorasse
149
149
  rdoc_options: []
150
150
  require_paths:
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.6.9
163
+ rubygems_version: 4.0.16
164
164
  specification_version: 4
165
165
  summary: Simple authorization solution for Rails.
166
166
  test_files: []