validates_duplicity_of 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +2 -2
- data/lib/validates_duplicity_of/callback.rb +1 -1
- data/lib/validates_duplicity_of/duplicator.rb +1 -1
- data/lib/validates_duplicity_of/record.rb +6 -2
- data/lib/validates_duplicity_of/version.rb +1 -1
- data/validates_duplicity_of.gemspec +3 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34399f4b894fc7fa23c9fd6e3b4c67450ca6beaa
|
4
|
+
data.tar.gz: a93f6e124232d3b6580751c87dd220e3449cec94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846803de4edb7445d19ad91344563fc37db684ee88df5d20a8e73a2675682f5349abeaad5f72468eda85d5995c5d9aed4624b25cb7c8ef842a82111f42cdd621
|
7
|
+
data.tar.gz: 0d1e52b088e22287db44cbc718771d0eeb768d27340ae07fc4f3357f9aa3ff833295e9d7b9b7acddcf720b662802c8943b2618d02b529768360b4a5c65422143
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# validates_duplicity_of
|
2
2
|
|
3
|
-
[![Build Status](https://
|
4
|
-
[![Gem](https://
|
3
|
+
[![Build Status](https://travis-ci.org/madwork/validates_duplicity_of.svg)](https://travis-ci.org/madwork/validates_duplicity_of)
|
4
|
+
[![Gem](https://badge.fury.io/rb/validates_duplicity_of.svg)](https://rubygems.org/gems/validates_duplicity_of)
|
5
5
|
|
6
6
|
ActiveRecord (>= 3.2) callback which handle the name duplication in your model with ease.
|
7
7
|
Ruby 2 only!
|
@@ -27,7 +27,7 @@ module ValidatesDuplicityOf
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def where_match(pattern)
|
30
|
-
scoped_relation.where
|
30
|
+
scoped_relation.where klass.arel_table[attr_name].matches(pattern)
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
@@ -45,7 +45,11 @@ module ValidatesDuplicityOf
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def scoped_relation
|
48
|
-
scope ?
|
48
|
+
scope ? klass.where(scope => __getobj__[scope]) : klass
|
49
|
+
end
|
50
|
+
|
51
|
+
def klass
|
52
|
+
__getobj__.class
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = "vincent.durand@madwork.org"
|
11
11
|
spec.description = "ActiveRecord callback which handle the name duplication in your model."
|
12
12
|
spec.summary = "ActiveRecord callback which handle the name duplication in your model with ease."
|
13
|
+
spec.homepage = "https://github.com/madwork/validates_duplicity_of"
|
13
14
|
spec.license = "MIT"
|
14
15
|
|
15
16
|
spec.files = `git ls-files`.split($/)
|
@@ -17,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
17
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
19
|
spec.require_paths = ["lib"]
|
19
20
|
|
21
|
+
spec.required_ruby_version = ">= 2.0"
|
22
|
+
|
20
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
24
|
spec.add_development_dependency "rake"
|
22
25
|
spec.add_development_dependency "rspec", ">= 2.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_duplicity_of
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,7 +106,7 @@ files:
|
|
106
106
|
- spec/support/models.rb
|
107
107
|
- spec/support/schema.rb
|
108
108
|
- validates_duplicity_of.gemspec
|
109
|
-
homepage:
|
109
|
+
homepage: https://github.com/madwork/validates_duplicity_of
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '0'
|
121
|
+
version: '2.0'
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.5.
|
129
|
+
rubygems_version: 2.5.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: ActiveRecord callback which handle the name duplication in your model with
|