paranoia_uniqueness_validator 3.3.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yaml +12 -0
- data/.github/workflows/ci.yaml +41 -0
- data/Gemfile +1 -1
- data/README.md +6 -12
- data/lib/paranoia_uniqueness_validator/validations/uniqueness_without_deleted.rb +1 -1
- data/lib/paranoia_uniqueness_validator/version.rb +1 -1
- data/paranoia_uniqueness_validator.gemspec +13 -14
- data/spec/dummy/config/application.rb +6 -6
- data/spec/dummy/config/environments/development.rb +6 -6
- data/spec/dummy/config/environments/production.rb +3 -3
- data/spec/dummy/config/environments/test.rb +4 -4
- data/spec/dummy/config/initializers/assets.rb +1 -1
- data/spec/validations/uniqueness_without_deleted_spec.rb +0 -1
- metadata +17 -17
- data/.github/dependabot.yml +0 -13
- data/.github/workflows/ci.yml +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87c8aa774c4ab10d1a2366105991a9951dfa5ac3114e9ea6f710810ee40107b9
|
4
|
+
data.tar.gz: 462fa5766b5bc5e7b9c10e4641e6dd323103a393d2b56ad28ebd2f0b5eb38b45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 967a7a93f12255b86a2f6210bf07287b92d6237b0f73d282514b893f70d51f34b37d241b1e28a7b46478b837137e207099e7cdb0d109de574138b562d98b849f
|
7
|
+
data.tar.gz: bb5e7c4ae01774c281ec4b9786b257622c2e3ad93a1132440e01763b60490844a9b22324d15d10e4671dd139a2b112546a8e7b1a7669d4d2a5e71017582a49c1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: ci
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
if: github.actor != 'dependabot[bot]' && github.event_name == 'push' ||
|
8
|
+
github.event_name == 'pull_request'
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
rails: ["6.1", "7.0", "7.1", "master"]
|
13
|
+
ruby: ["3.0", "3.1", "3.2"]
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
|
23
|
+
- name: Install toolchain
|
24
|
+
run: |
|
25
|
+
sudo apt-get update
|
26
|
+
sudo apt-get install \
|
27
|
+
build-essential \
|
28
|
+
libsqlite3-dev
|
29
|
+
|
30
|
+
- name: Install bundler
|
31
|
+
run: gem install bundler
|
32
|
+
|
33
|
+
- env:
|
34
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
35
|
+
name: Install dependencies
|
36
|
+
run: bundle install
|
37
|
+
|
38
|
+
- env:
|
39
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
40
|
+
name: Test
|
41
|
+
run: bundle exec rspec
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -13,20 +13,14 @@ gem that uses the `deleted_at` field for marking records as deleted.
|
|
13
13
|
|
14
14
|
Add this line to your application's Gemfile:
|
15
15
|
|
16
|
-
# Rails
|
17
|
-
gem 'paranoia_uniqueness_validator', '
|
18
|
-
|
19
|
-
# Rails 4
|
20
|
-
gem 'paranoia_uniqueness_validator', '1.1.0'
|
21
|
-
|
22
|
-
# Rails 5.0
|
23
|
-
gem 'paranoia_uniqueness_validator', '2.0.0'
|
16
|
+
# Rails 6.1
|
17
|
+
gem 'paranoia_uniqueness_validator', '3.3.0'
|
24
18
|
|
25
|
-
# Rails
|
26
|
-
gem 'paranoia_uniqueness_validator', '3.
|
19
|
+
# Rails 7
|
20
|
+
gem 'paranoia_uniqueness_validator', '3.4.0'
|
27
21
|
|
28
|
-
# Rails
|
29
|
-
gem 'paranoia_uniqueness_validator', '3.
|
22
|
+
# Rails 7.1
|
23
|
+
gem 'paranoia_uniqueness_validator', '3.5.0'
|
30
24
|
|
31
25
|
And then execute:
|
32
26
|
|
@@ -28,7 +28,7 @@ module ParanoiaUniquenessValidator
|
|
28
28
|
error_options = options.except(:case_sensitive, :scope, :conditions)
|
29
29
|
error_options[:value] = value
|
30
30
|
|
31
|
-
record.errors.add(attribute, :taken, error_options)
|
31
|
+
record.errors.add(attribute, :taken, **error_options)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,26 +1,25 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'paranoia_uniqueness_validator/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
6
|
+
gem.name = 'paranoia_uniqueness_validator'
|
8
7
|
gem.version = ParanoiaUniquenessValidator::VERSION
|
9
8
|
gem.licenses = ['MIT']
|
10
|
-
gem.authors = [
|
11
|
-
gem.email = [
|
12
|
-
gem.description =
|
13
|
-
gem.summary =
|
14
|
-
gem.homepage =
|
9
|
+
gem.authors = ['Anthony Smith']
|
10
|
+
gem.email = ['anthony@sticksnleaves.com']
|
11
|
+
gem.description = 'Adds the validates_uniqueness_without_deleted validator to ignore deleted fields when validating for uniqueness.'
|
12
|
+
gem.summary = 'Validate unique fields without letting those pesky deleted records get in the way. Great for use with Paranoia.'
|
13
|
+
gem.homepage = 'https://github.com/anthonator/paranoia_uniqueness_validator'
|
15
14
|
|
16
15
|
gem.files = `git ls-files`.split($/)
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
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
|
-
gem.require_paths = [
|
18
|
+
gem.require_paths = ['lib']
|
20
19
|
|
21
|
-
gem.add_dependency
|
20
|
+
gem.add_dependency 'activerecord', '>= 6.1', '< 7.2'
|
22
21
|
|
23
|
-
gem.add_development_dependency
|
24
|
-
gem.add_development_dependency
|
25
|
-
gem.add_development_dependency
|
22
|
+
gem.add_development_dependency 'database_cleaner', '~> 2.0'
|
23
|
+
gem.add_development_dependency 'paranoia', '~> 2.3'
|
24
|
+
gem.add_development_dependency 'rspec-rails', '~> 6.1'
|
26
25
|
end
|
@@ -3,13 +3,13 @@ require_relative 'boot'
|
|
3
3
|
require "rails"
|
4
4
|
# Pick the frameworks you want:
|
5
5
|
require "active_model/railtie"
|
6
|
-
require "active_job/railtie"
|
6
|
+
# require "active_job/railtie"
|
7
7
|
require "active_record/railtie"
|
8
|
-
require "action_controller/railtie"
|
9
|
-
require "action_mailer/railtie"
|
10
|
-
require "action_view/railtie"
|
11
|
-
require "action_cable/engine"
|
12
|
-
require "sprockets/railtie"
|
8
|
+
# require "action_controller/railtie"
|
9
|
+
# require "action_mailer/railtie"
|
10
|
+
# require "action_view/railtie"
|
11
|
+
# require "action_cable/engine"
|
12
|
+
# require "sprockets/railtie"
|
13
13
|
# require "rails/test_unit/railtie"
|
14
14
|
|
15
15
|
# Require the gems listed in Gemfile, including any gems
|
@@ -14,22 +14,22 @@ Rails.application.configure do
|
|
14
14
|
|
15
15
|
# Enable/disable caching. By default caching is disabled.
|
16
16
|
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
-
config.action_controller.perform_caching = true
|
17
|
+
# config.action_controller.perform_caching = true
|
18
18
|
|
19
19
|
config.cache_store = :memory_store
|
20
20
|
config.public_file_server.headers = {
|
21
21
|
'Cache-Control' => 'public, max-age=172800'
|
22
22
|
}
|
23
23
|
else
|
24
|
-
config.action_controller.perform_caching = false
|
24
|
+
# config.action_controller.perform_caching = false
|
25
25
|
|
26
26
|
config.cache_store = :null_store
|
27
27
|
end
|
28
28
|
|
29
29
|
# Don't care if the mailer can't send.
|
30
|
-
config.action_mailer.raise_delivery_errors = false
|
30
|
+
# config.action_mailer.raise_delivery_errors = false
|
31
31
|
|
32
|
-
config.action_mailer.perform_caching = false
|
32
|
+
# config.action_mailer.perform_caching = false
|
33
33
|
|
34
34
|
# Print deprecation notices to the Rails logger.
|
35
35
|
config.active_support.deprecation = :log
|
@@ -40,10 +40,10 @@ Rails.application.configure do
|
|
40
40
|
# Debug mode disables concatenation and preprocessing of assets.
|
41
41
|
# This option may cause significant delays in view rendering with a large
|
42
42
|
# number of complex assets.
|
43
|
-
config.assets.debug = true
|
43
|
+
# config.assets.debug = true
|
44
44
|
|
45
45
|
# Suppress logger output for asset requests.
|
46
|
-
config.assets.quiet = true
|
46
|
+
# config.assets.quiet = true
|
47
47
|
|
48
48
|
# Raises error for missing translations
|
49
49
|
# config.action_view.raise_on_missing_translations = true
|
@@ -12,18 +12,18 @@ Rails.application.configure do
|
|
12
12
|
|
13
13
|
# Full error reports are disabled and caching is turned on.
|
14
14
|
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
15
|
+
# config.action_controller.perform_caching = true
|
16
16
|
|
17
17
|
# Disable serving static files from the `/public` folder by default since
|
18
18
|
# Apache or NGINX already handles this.
|
19
19
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
20
20
|
|
21
21
|
# Compress JavaScripts and CSS.
|
22
|
-
config.assets.js_compressor = :uglifier
|
22
|
+
# config.assets.js_compressor = :uglifier
|
23
23
|
# config.assets.css_compressor = :sass
|
24
24
|
|
25
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
26
|
-
config.assets.compile = false
|
26
|
+
# config.assets.compile = false
|
27
27
|
|
28
28
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
29
29
|
|
@@ -20,19 +20,19 @@ Rails.application.configure do
|
|
20
20
|
|
21
21
|
# Show full error reports and disable caching.
|
22
22
|
config.consider_all_requests_local = true
|
23
|
-
config.action_controller.perform_caching = false
|
23
|
+
# config.action_controller.perform_caching = false
|
24
24
|
|
25
25
|
# Raise exceptions instead of rendering exception templates.
|
26
26
|
config.action_dispatch.show_exceptions = false
|
27
27
|
|
28
28
|
# Disable request forgery protection in test environment.
|
29
|
-
config.action_controller.allow_forgery_protection = false
|
30
|
-
config.action_mailer.perform_caching = false
|
29
|
+
# config.action_controller.allow_forgery_protection = false
|
30
|
+
# config.action_mailer.perform_caching = false
|
31
31
|
|
32
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
33
33
|
# The :test delivery method accumulates sent emails in the
|
34
34
|
# ActionMailer::Base.deliveries array.
|
35
|
-
config.action_mailer.delivery_method = :test
|
35
|
+
# config.action_mailer.delivery_method = :test
|
36
36
|
|
37
37
|
# Print deprecation notices to the stderr.
|
38
38
|
config.active_support.deprecation = :stderr
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
3
|
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = '1.0'
|
4
|
+
# Rails.application.config.assets.version = '1.0'
|
5
5
|
|
6
6
|
# Add additional assets to the asset load path
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
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.5.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: 2023-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,62 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '6.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '6.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: database_cleaner
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '2.
|
39
|
+
version: '2.0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '2.
|
46
|
+
version: '2.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: paranoia
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '2.3'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '2.3'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec-rails
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '6.1'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '6.1'
|
75
75
|
description: Adds the validates_uniqueness_without_deleted validator to ignore deleted
|
76
76
|
fields when validating for uniqueness.
|
77
77
|
email:
|
@@ -80,8 +80,8 @@ executables: []
|
|
80
80
|
extensions: []
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
|
-
- ".github/dependabot.
|
84
|
-
- ".github/workflows/ci.
|
83
|
+
- ".github/dependabot.yaml"
|
84
|
+
- ".github/workflows/ci.yaml"
|
85
85
|
- ".gitignore"
|
86
86
|
- Gemfile
|
87
87
|
- LICENSE.txt
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.4.10
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Validate unique fields without letting those pesky deleted records get in
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/ci.yml
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
name: ci
|
2
|
-
|
3
|
-
on: push
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
strategy:
|
8
|
-
matrix:
|
9
|
-
rails: ['6.1', '5.2']
|
10
|
-
|
11
|
-
ruby: ['2.5', '2.6', '2.7']
|
12
|
-
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
|
15
|
-
steps:
|
16
|
-
- uses: actions/checkout@v2
|
17
|
-
|
18
|
-
- uses: actions/setup-ruby@v1
|
19
|
-
|
20
|
-
with:
|
21
|
-
ruby-version: ${{ matrix.ruby }}
|
22
|
-
|
23
|
-
- name: Install native toolchain
|
24
|
-
|
25
|
-
run: |
|
26
|
-
sudo apt-get update
|
27
|
-
|
28
|
-
sudo apt-get install build-essential libsqlite3-dev
|
29
|
-
|
30
|
-
- name: Run gem install bundler
|
31
|
-
|
32
|
-
run: gem install bundler
|
33
|
-
|
34
|
-
- name: Run bundle install
|
35
|
-
|
36
|
-
env:
|
37
|
-
RAILS_VERSION: ${{ matrix.rails }}
|
38
|
-
|
39
|
-
run: bundle install
|
40
|
-
|
41
|
-
- name: Run bundle exec rspec
|
42
|
-
|
43
|
-
env:
|
44
|
-
RAILS_VERSION: ${{ matrix.rails }}
|
45
|
-
|
46
|
-
run: bundle exec rspec
|