paranoia_uniqueness_validator 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +10 -3
- data/Gemfile +23 -1
- data/lib/paranoia_uniqueness_validator/validations/uniqueness_without_deleted.rb +6 -1
- data/lib/paranoia_uniqueness_validator/version.rb +1 -1
- data/paranoia_uniqueness_validator.gemspec +0 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- metadata +15 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c8349a30e88d13b9971047c6d29d61dd7128bf0
|
4
|
+
data.tar.gz: 287a9fdef45d7de4f778812ef448d16dca1c96c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e9b1d5ffdd891470b02979736783f422a236b678da580a8caf67b2c34a20db18e59efc3e4a58d91f3bbd4bc6941177dfd80d22a94d4e0643baa8b023092737
|
7
|
+
data.tar.gz: 5c0a1049cf15ea515caa4f14acc70ab06b87b0e7d36940eeaa7cbf05e63fd69088b17ed29ddd4ca8c1f03d6e865ba1a47fbedcc6d4ab682dfdc84c182cf3f038
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -2,10 +2,17 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
|
+
- 2.1.0
|
6
|
+
- 2.2.0
|
5
7
|
- ruby-head
|
6
8
|
- jruby-19mode
|
7
9
|
- jruby-head
|
8
|
-
- rbx
|
10
|
+
- rbx
|
11
|
+
env:
|
12
|
+
- "RAILS_VERSION=4.0.0"
|
13
|
+
- "RAILS_VERSION=4.1.0"
|
14
|
+
- "RAILS_VERSION=4.2.0"
|
9
15
|
matrix:
|
10
|
-
|
11
|
-
- rvm: ruby-head
|
16
|
+
allow_failures:
|
17
|
+
- rvm: ruby-head
|
18
|
+
- rvm: jruby-head
|
data/Gemfile
CHANGED
@@ -3,13 +3,35 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in paranoia_uniqueness_validator.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
+
rails_version = ENV['RAILS_VERSION'] || 'default'
|
7
|
+
|
8
|
+
rails = case rails_version
|
9
|
+
when 'master'
|
10
|
+
{ github: 'rails/rails' }
|
11
|
+
when 'default'
|
12
|
+
'>= 4.2.0'
|
13
|
+
else
|
14
|
+
"~> #{rails_version}"
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'rails', rails
|
18
|
+
|
6
19
|
platforms :jruby do
|
7
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
20
|
+
gem "activerecord-jdbcsqlite3-adapter"
|
8
21
|
gem "jruby-openssl"
|
9
22
|
end
|
10
23
|
|
11
24
|
platforms :ruby do
|
12
25
|
gem "sqlite3"
|
26
|
+
gem "test-unit"
|
27
|
+
end
|
28
|
+
|
29
|
+
platforms :rbx do
|
30
|
+
#gem 'psych'
|
31
|
+
#gem 'racc'
|
32
|
+
#gem 'rubinius-coverage'
|
33
|
+
#gem 'rubysl'
|
34
|
+
#gem 'rubysl-test-unit'
|
13
35
|
end
|
14
36
|
|
15
37
|
group :development do
|
@@ -4,7 +4,12 @@ module ParanoiaUniquenessValidator
|
|
4
4
|
def validate_each(record, attribute, value)
|
5
5
|
finder_class = find_finder_class_for(record)
|
6
6
|
table = finder_class.arel_table
|
7
|
-
|
7
|
+
|
8
|
+
if ActiveRecord.version.to_s >= '4.2.0'
|
9
|
+
value = map_enum_attribute(finder_class, attribute, value)
|
10
|
+
else
|
11
|
+
value = deserialize_attribute(record, attribute, value)
|
12
|
+
end
|
8
13
|
|
9
14
|
relation = build_relation(finder_class, table, attribute, value)
|
10
15
|
relation = relation.and(table[finder_class.primary_key.to_sym].not_eq(record.id)) if record.persisted?
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,83 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paranoia_uniqueness_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.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: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: paranoia
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: database_cleaner
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.0.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 4.0.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec-rails
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
description: Adds the validates_uniqueness_without_deleted validator to ignore deleted
|
@@ -88,8 +74,8 @@ executables: []
|
|
88
74
|
extensions: []
|
89
75
|
extra_rdoc_files: []
|
90
76
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .travis.yml
|
77
|
+
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
93
79
|
- Gemfile
|
94
80
|
- LICENSE.txt
|
95
81
|
- README.md
|
@@ -157,17 +143,17 @@ require_paths:
|
|
157
143
|
- lib
|
158
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
145
|
requirements:
|
160
|
-
- -
|
146
|
+
- - ">="
|
161
147
|
- !ruby/object:Gem::Version
|
162
148
|
version: '0'
|
163
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
150
|
requirements:
|
165
|
-
- -
|
151
|
+
- - ">="
|
166
152
|
- !ruby/object:Gem::Version
|
167
153
|
version: '0'
|
168
154
|
requirements: []
|
169
155
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.4.5
|
171
157
|
signing_key:
|
172
158
|
specification_version: 4
|
173
159
|
summary: Validate unique fields without letting those pesky deleted records get in
|