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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8b90099bcbf9b7c0c7b0d028e59ef9523a16c8a
4
- data.tar.gz: 67ca17220649e95757c4516c44f2ce0120c085c9
3
+ metadata.gz: 1c8349a30e88d13b9971047c6d29d61dd7128bf0
4
+ data.tar.gz: 287a9fdef45d7de4f778812ef448d16dca1c96c3
5
5
  SHA512:
6
- metadata.gz: a015e0b9a1735a0f3b232182e1358f1cf7302add1c4a2c43904b1172ad9b4fb62938d226b6116b3c1df6243b22c40f98259e68421b78348b1bb1346627f0dd50
7
- data.tar.gz: 3b732dbc202f68aa2bb3a3d7e63faffcb0b7bfb473468bce34ba996e49cf3accedf98d7b8698aa69c9288fa1c186aae30b87b5596ca3170e0271481d7291001d
6
+ metadata.gz: 43e9b1d5ffdd891470b02979736783f422a236b678da580a8caf67b2c34a20db18e59efc3e4a58d91f3bbd4bc6941177dfd80d22a94d4e0643baa8b023092737
7
+ data.tar.gz: 5c0a1049cf15ea515caa4f14acc70ab06b87b0e7d36940eeaa7cbf05e63fd69088b17ed29ddd4ca8c1f03d6e865ba1a47fbedcc6d4ab682dfdc84c182cf3f038
data/.gitignore CHANGED
@@ -7,4 +7,5 @@ spec/dummy/log/*.log
7
7
  spec/dummy/tmp/
8
8
  spec/dummy/.sass-cache
9
9
  Gemfile.lock
10
- .rbenv*
10
+ .rbenv*
11
+ coverage
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-19mode
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
- allow_failtures:
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", :git => "git://github.com/jruby/activerecord-jdbc-adapter.git"
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
- value = deserialize_attribute(record, attribute, value)
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?
@@ -1,3 +1,3 @@
1
1
  module ParanoiaUniquenessValidator
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -21,6 +21,5 @@ Gem::Specification.new do |gem|
21
21
 
22
22
  gem.add_development_dependency "paranoia"
23
23
  gem.add_development_dependency "database_cleaner"
24
- gem.add_development_dependency "rails", ">= 4.0.0"
25
24
  gem.add_development_dependency "rspec-rails"
26
25
  end
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.1
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: 2013-10-20 00:00:00.000000000 Z
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.0.3
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