activerecord-rescue_from_duplicate 0.1.3 → 0.1.4

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: 57e38eb0a3e8bc47bc4c1e7e299c4ca6b30a4ffa14d9982db17d88086f3dc0ae
4
- data.tar.gz: d963ba4a9a08bd3c6ba193bff5ca84f57074e3e0f68afd7a43ff6c02b02accb3
3
+ metadata.gz: f5f7eaa93b0b20c8fc29f1d4728f1d351a73cc09bb87ce89acd9dfb63d1c7d3a
4
+ data.tar.gz: fab39632f4acf9163fed49ff102245fdd89255878fe26493e031e83b44d81639
5
5
  SHA512:
6
- metadata.gz: e703b89e8bcb6a4b722ca14fda626f837fe49cfca11cd1ced6023b2d54b0fde559e26e87e808ae5918ab9c180e27142ada04be181c1690122a16774906bee28f
7
- data.tar.gz: 3c87f3a1f4f8c5e3233a2a603075bf62f9c0e49dcf6f9257c0e8b98de4bf16c5078b9c718537dd6aea0de704712381d833b7a3b1e544c87eed3a57103426524f
6
+ metadata.gz: a94279a803e5f6294fe7e5fc6ac23d3d24a47b4ed04683c1b980ed5ba74946339dd13a27b5059bac1d7a5d9a5f752cd17b4ce88934fe5c6a2d47a73aeee38520
7
+ data.tar.gz: 05a94c7db56f45477f18693d2b27ecf1a7bfc09446d667e0e9aae69db35bf23235b27ff35ee47a300f0fad750c5e4ec225c59bcf7e42ce49d4d0450920d1a5a6
data/.travis.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  sudo: false
2
2
  rvm:
3
- - 2.5.0
3
+ - '2.5'
4
+ - '2.6'
5
+ - '2.7'
4
6
 
5
7
  env:
6
8
  - DOCKER_COMPOSE_VERSION=1.20.1
@@ -28,4 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "rspec"
29
29
  spec.add_development_dependency "pg"
30
30
  spec.add_development_dependency "pry"
31
+
32
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
31
33
  end
@@ -22,7 +22,7 @@ module RescueFromDuplicate::ActiveRecord
22
22
  self._rescue_from_duplicates = []
23
23
  end
24
24
 
25
- def create_or_update(*params, &block)
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: ([^:]*)\:/, 1])
71
+ extract_columns(exception.message[/UNIQUE constraint failed: ([^:]*)\:?/, 1])
72
+
72
73
  end
73
74
 
74
75
  def extract_columns(columns_string)
@@ -1,5 +1,5 @@
1
1
  module Activerecord
2
2
  module RescueFromDuplicate
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
@@ -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.3
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: 2019-04-05 00:00:00.000000000 Z
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
- rubyforge_project:
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