database_validations 2.1.0 → 2.1.2

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: cb8e88ed5b20821f4c5ebd14e90ea1505689ea2d68619608b832c18ece68a50c
4
- data.tar.gz: 4b658e6f4d179735bd6fc73002e9790ed18bb4134119a00403fe51bba3d4bba6
3
+ metadata.gz: 255d7abe6bea01a42005aaf476a0956e0b86edbf0916bbac6e79192b3c2437a5
4
+ data.tar.gz: 4ffa2d08d01c26e1ba4975b2b9854c0014fb8343182cb471b7459c6698a20a1c
5
5
  SHA512:
6
- metadata.gz: 7053335a8acdf7dbf0f64a9c8e4bdfecaa6300a285158911af5d436f59265c05d36f118347c4e36b9016e6c4284ff54b0f680c30bbaba80ec4649ef2922da742
7
- data.tar.gz: 4887ce0d4ab98df0498b7df3531bc8ecdc49c85b8af3bb22606f2bc1df3b3c9de871216abe9ef16ca9c1cb6c33b3382c7a2da63bf13464e0c852ff0e1e891b0c
6
+ metadata.gz: 4a71bc5c81efda997c988f1b893b8d5a341a3736069fda623465bdb0e75ed63310dad66b628b47cc4f8bfdfee7595e8ac2aa7e8cea6b4f7f8aeddb8038df6bb6
7
+ data.tar.gz: 75ac1fd340edc2bf7317462cf1b42cb3f0f7ce9557d4746c9003b1838eef2891a403be6065b1c46969fe972b962e7c442fba418f679a0fca1012c83b139755f1
@@ -8,13 +8,18 @@ module DatabaseValidations
8
8
  error.message[/unique constraint "([^"]+)"/, 1]
9
9
  end
10
10
 
11
+ # PostgreSQL leaves the `DETAIL: Key (...)=(...) already exists.` line out of a unique violation on a
12
+ # table the current role is subject to row-level security on, because the values could belong to a row the
13
+ # role cannot see. The columns are then unknown (nil) and the error is matched by its index name instead.
11
14
  def unique_error_columns(error)
12
- error.message[/Key \((.+)\)=/, 1].split(', ')
15
+ error.message[/Key \((.+)\)=/, 1]&.split(', ')
13
16
  end
14
17
 
18
+ # A composite key reports every column, `Key (tenant_id, company_id)=(1, 2)`; each is a candidate, and the
19
+ # rescuer picks the one with a matching `db_belongs_to`.
15
20
  def foreign_key_error_column(error)
16
- column = error.message[/Key \(([^)]+)\)/, 1]
17
- column ? [column] : []
21
+ columns = error.message[/Key \(([^)]+)\)/, 1]
22
+ columns ? columns.split(', ') : []
18
23
  end
19
24
  end
20
25
  end
@@ -1,3 +1,3 @@
1
1
  module DatabaseValidations
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: 7.2.0
26
- - !ruby/object:Gem::Dependency
27
- name: lint_roller
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: benchmark-ips
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -242,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
228
  - !ruby/object:Gem::Version
243
229
  version: '0'
244
230
  requirements: []
245
- rubygems_version: 3.6.9
231
+ rubygems_version: 4.0.23
246
232
  specification_version: 4
247
233
  summary: Provide compatibility between database constraints and ActiveRecord validations
248
234
  with better performance and consistency.