paranoia_uniqueness_validator 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -5
- data/Gemfile +12 -24
- data/README.md +11 -9
- data/docker-compose.yml +1 -1
- data/lib/paranoia_uniqueness_validator/version.rb +1 -1
- data/paranoia_uniqueness_validator.gemspec +1 -2
- data/spec/validations/uniqueness_without_deleted_spec.rb +0 -4
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad677703e42c01ec0721669a8c403f712119253e474584bea1d0d44f351702c9
|
4
|
+
data.tar.gz: 0f0ffc054f4c45bfbbf222035d554317d159e9a159c05dee50d609ee8000b9da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efa2e10bf1ff3f168c750293828a1d0ecee68bece17fd7b09d9d59e2bf3496cab9bf88dda5ad1f4ff924c60e4e8a8cdf0c2fc02d9eed4ff6ba5a395e2c5832d0
|
7
|
+
data.tar.gz: 2c20e3b4d98a007e49983faa935b5f53a0aea9f671e778931ab1bc9c31bfbdd9c9f7e6969d208d41866fe68d1d4a29785ebe9983baf64fb813597671cec501c2
|
data/.travis.yml
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.2.
|
4
|
-
- 2.3.
|
5
|
-
- 2.4.
|
3
|
+
- 2.2.9
|
4
|
+
- 2.3.7
|
5
|
+
- 2.4.4
|
6
|
+
- 2.5.1
|
6
7
|
- ruby-head
|
7
|
-
- jruby-head
|
8
8
|
env:
|
9
9
|
- "RAILS_VERSION=master"
|
10
10
|
- "RAILS_VERSION=5.1.0"
|
11
|
+
- "RAILS_VERSION=5.2.0"
|
11
12
|
matrix:
|
12
13
|
allow_failures:
|
13
14
|
- rvm: ruby-head
|
14
|
-
- rvm: jruby-head
|
15
15
|
- env: RAILS_VERSION=master
|
16
16
|
sudo: false
|
data/Gemfile
CHANGED
@@ -5,35 +5,23 @@ gemspec
|
|
5
5
|
|
6
6
|
rails_version = ENV['RAILS_VERSION'] || 'default'
|
7
7
|
|
8
|
-
rails =
|
9
|
-
|
10
|
-
when 'master'
|
11
|
-
|
12
|
-
when 'default'
|
13
|
-
|
14
|
-
else
|
15
|
-
|
16
|
-
end
|
8
|
+
rails =
|
9
|
+
case rails_version
|
10
|
+
when 'master'
|
11
|
+
{ github: 'rails/rails' }
|
12
|
+
when 'default'
|
13
|
+
'>= 5.2.0'
|
14
|
+
else
|
15
|
+
"~> #{rails_version}"
|
16
|
+
end
|
17
17
|
|
18
18
|
gem 'rails', rails
|
19
19
|
|
20
|
-
platforms :jruby do
|
21
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
22
|
-
gem "jruby-openssl"
|
23
|
-
end
|
24
|
-
|
25
|
-
platforms :ruby do
|
26
|
-
gem "sqlite3"
|
27
|
-
gem "test-unit"
|
28
|
-
end
|
29
|
-
|
30
|
-
platforms :ruby_19, :jruby_19 do
|
31
|
-
gem "mime-types", "< 3.0"
|
32
|
-
end
|
33
|
-
|
34
20
|
group :development do
|
35
21
|
gem 'bundler'
|
36
|
-
gem 'coveralls', :
|
22
|
+
gem 'coveralls', require: false
|
37
23
|
gem 'listen'
|
38
24
|
gem 'rake'
|
25
|
+
gem "sqlite3"
|
26
|
+
gem "test-unit"
|
39
27
|
end
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# ParanoiaUniquenessValidator
|
2
2
|
|
3
|
-
Adds
|
3
|
+
Adds `validates_uniqueness_without_deleted`.
|
4
4
|
|
5
|
-
This validator will ignore any record that has a non-null value for the
|
5
|
+
This validator will ignore any record that has a non-null value for the
|
6
|
+
`deleted_at` field. This gem was made specifically for use with the
|
7
|
+
[Paranoia](https://github.com/radar/paranoia) gem but it can be used with any
|
8
|
+
gem that uses the `deleted_at` field for marking records as deleted.
|
6
9
|
|
7
10
|
[![Gem Version](https://badge.fury.io/rb/paranoia_uniqueness_validator.png)](http://badge.fury.io/rb/paranoia_uniqueness_validator) [![Build Status](https://secure.travis-ci.org/anthonator/paranoia_uniqueness_validator.png)](http://travis-ci.org/anthonator/paranoia_uniqueness_validator) [![Dependency Status](https://gemnasium.com/anthonator/paranoia_uniqueness_validator.png)](https://gemnasium.com/anthonator/paranoia_uniqueness_validator) [![Coverage Status](https://coveralls.io/repos/anthonator/paranoia_uniqueness_validator/badge.png)](https://coveralls.io/r/anthonator/paranoia_uniqueness_validator) [![Code Climate](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator.png)](https://codeclimate.com/github/anthonator/paranoia_uniqueness_validator)
|
8
11
|
|
@@ -19,8 +22,8 @@ Add this line to your application's Gemfile:
|
|
19
22
|
# Rails 5.0
|
20
23
|
gem 'paranoia_uniqueness_validator', '2.0.0'
|
21
24
|
|
22
|
-
# Rails 5.1
|
23
|
-
gem 'paranoia_uniqueness_validator', '3.
|
25
|
+
# Rails 5.1+
|
26
|
+
gem 'paranoia_uniqueness_validator', '3.1.0'
|
24
27
|
|
25
28
|
And then execute:
|
26
29
|
|
@@ -32,13 +35,14 @@ Or install it yourself as:
|
|
32
35
|
|
33
36
|
## Configuration
|
34
37
|
|
35
|
-
This validator supports all configuration options used by the base ActiveRecord
|
38
|
+
This validator supports all configuration options used by the base ActiveRecord
|
39
|
+
uniqueness validator. For more information check out the [Rails API documentation](http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of).
|
36
40
|
|
37
41
|
## Usage
|
38
42
|
|
39
43
|
```ruby
|
40
44
|
class SomeModel < ActiveRecord::Base
|
41
|
-
|
45
|
+
validates :some_field, uniqueness_without_deleted: true
|
42
46
|
end
|
43
47
|
```
|
44
48
|
|
@@ -52,8 +56,6 @@ end
|
|
52
56
|
|
53
57
|
## Credits
|
54
58
|
|
55
|
-
[
|
56
|
-
|
57
|
-
paranoia_uniqueness_validator is maintained and funded by [Sticksnleaves](http://www.sticksnleaves.com)
|
59
|
+
`paranoia_uniqueness_validator` is maintained and funded by [Sticksnleaves](http://www.sticksnleaves.com)
|
58
60
|
|
59
61
|
Thanks to all of our [contributors](https://github.com/anthonator/paranoia_uniqueness_validator/graphs/contributors)
|
data/docker-compose.yml
CHANGED
@@ -11,14 +11,13 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Adds the validates_uniqueness_without_deleted validator to ignore deleted fields when validating for uniqueness.}
|
12
12
|
gem.summary = %q{Validate unique fields without letting those pesky deleted records get in the way. Great for use with Paranoia.}
|
13
13
|
gem.homepage = "https://github.com/anthonator/paranoia_uniqueness_validator"
|
14
|
-
gem.license = "MIT"
|
15
14
|
|
16
15
|
gem.files = `git ls-files`.split($/)
|
17
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
18
|
gem.require_paths = ["lib"]
|
20
19
|
|
21
|
-
gem.add_dependency "activerecord", ">= 5.1.0", "<
|
20
|
+
gem.add_dependency "activerecord", ">= 5.1.0", "< 6.0"
|
22
21
|
|
23
22
|
gem.add_development_dependency "paranoia", "~> 2.3"
|
24
23
|
gem.add_development_dependency "database_cleaner", "~> 1.6"
|
@@ -17,11 +17,9 @@ describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValid
|
|
17
17
|
|
18
18
|
expect(DummyModel.new(:unique_field => "unique")).to be_valid
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
22
21
|
|
23
22
|
context 'with datetime (non nil) default_sentinel_value' do
|
24
|
-
|
25
23
|
before(:all) do
|
26
24
|
if Paranoia.respond_to?(:default_sentinel_value)
|
27
25
|
Paranoia.default_sentinel_value = DateTime.new(0)
|
@@ -42,7 +40,5 @@ describe ParanoiaUniquenessValidator::Validations::UniquenessWithoutDeletedValid
|
|
42
40
|
dummy_model = DummyNonNilModel.new(:unique_field => "unique")
|
43
41
|
expect(dummy_model).to be_valid
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
47
|
-
|
48
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paranoia_uniqueness_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 5.1.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 5.1.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: paranoia
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,8 +164,7 @@ files:
|
|
164
164
|
- spec/spec_helper.rb
|
165
165
|
- spec/validations/uniqueness_without_deleted_spec.rb
|
166
166
|
homepage: https://github.com/anthonator/paranoia_uniqueness_validator
|
167
|
-
licenses:
|
168
|
-
- MIT
|
167
|
+
licenses: []
|
169
168
|
metadata: {}
|
170
169
|
post_install_message:
|
171
170
|
rdoc_options: []
|
@@ -183,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
182
|
version: '0'
|
184
183
|
requirements: []
|
185
184
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.7.4
|
187
186
|
signing_key:
|
188
187
|
specification_version: 4
|
189
188
|
summary: Validate unique fields without letting those pesky deleted records get in
|