activerecord-rescue_from_duplicate 0.1.3 → 0.1.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5f7eaa93b0b20c8fc29f1d4728f1d351a73cc09bb87ce89acd9dfb63d1c7d3a
|
4
|
+
data.tar.gz: fab39632f4acf9163fed49ff102245fdd89255878fe26493e031e83b44d81639
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94279a803e5f6294fe7e5fc6ac23d3d24a47b4ed04683c1b980ed5ba74946339dd13a27b5059bac1d7a5d9a5f752cd17b4ce88934fe5c6a2d47a73aeee38520
|
7
|
+
data.tar.gz: 05a94c7db56f45477f18693d2b27ecf1a7bfc09446d667e0e9aae69db35bf23235b27ff35ee47a300f0fad750c5e4ec225c59bcf7e42ce49d4d0450920d1a5a6
|
data/.travis.yml
CHANGED
@@ -22,7 +22,7 @@ module RescueFromDuplicate::ActiveRecord
|
|
22
22
|
self._rescue_from_duplicates = []
|
23
23
|
end
|
24
24
|
|
25
|
-
def create_or_update(
|
25
|
+
def create_or_update(*, **)
|
26
26
|
super
|
27
27
|
rescue ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid => exception
|
28
28
|
raise unless handle_unicity_error(exception)
|
@@ -68,7 +68,8 @@ module RescueFromDuplicate::ActiveRecord
|
|
68
68
|
|
69
69
|
def sqlite3_exception_columns(exception)
|
70
70
|
extract_columns(exception.message[/columns? (.*) (?:is|are) not unique/, 1]) ||
|
71
|
-
extract_columns(exception.message[/UNIQUE constraint failed: ([^:]*)
|
71
|
+
extract_columns(exception.message[/UNIQUE constraint failed: ([^:]*)\:?/, 1])
|
72
|
+
|
72
73
|
end
|
73
74
|
|
74
75
|
def extract_columns(columns_string)
|
data/spec/support/model.rb
CHANGED
@@ -61,7 +61,7 @@ module TestModel
|
|
61
61
|
def self.included(base)
|
62
62
|
base.rescue_from_duplicate(:handle, scope: :relation_id, message: "handle must be unique for this relation")
|
63
63
|
|
64
|
-
base.validates(:name, uniqueness: { rescue_from_duplicate: true }, allow_nil: true)
|
64
|
+
base.validates(:name, uniqueness: { rescue_from_duplicate: true, case_sensitive: true }, allow_nil: true)
|
65
65
|
base.validates(:size, uniqueness: { rescue_from_duplicate: true }, allow_nil: true)
|
66
66
|
end
|
67
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-rescue_from_duplicate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Malette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -169,7 +169,8 @@ files:
|
|
169
169
|
homepage: https://github.com/Shopify/activerecord-rescue_from_duplicate
|
170
170
|
licenses:
|
171
171
|
- MIT
|
172
|
-
metadata:
|
172
|
+
metadata:
|
173
|
+
allowed_push_host: https://rubygems.org
|
173
174
|
post_install_message:
|
174
175
|
rdoc_options: []
|
175
176
|
require_paths:
|
@@ -185,8 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
186
|
- !ruby/object:Gem::Version
|
186
187
|
version: '0'
|
187
188
|
requirements: []
|
188
|
-
|
189
|
-
rubygems_version: 2.7.6
|
189
|
+
rubygems_version: 3.0.3
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: Rescue from MySQL and Sqlite duplicate errors when trying to insert records
|