run_cl 1.0.22 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/run_cl/uniq_run_validator.rb +5 -1
- data/lib/run_cl/version.rb +1 -1
- metadata +3 -3
@@ -4,7 +4,11 @@ class UniqRunValidator < ActiveModel::Validator
|
|
4
4
|
def validate record
|
5
5
|
options[:attributes].each do |attribute|
|
6
6
|
run = Run.remove_format record.send(attribute)
|
7
|
-
|
7
|
+
if record.new_record?
|
8
|
+
record.errors[attribute.to_sym] << 'ya está en uso!!!' if record.class.where(attribute => run).any?
|
9
|
+
else
|
10
|
+
record.errors[attribute.to_sym] << 'ya está en uso!!!' if record.class.where('? = ? AND id != ?', attribute, run, record.id).any?
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
|
data/lib/run_cl/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 23
|
9
|
+
version: 1.0.23
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- mespina
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2013-03-
|
17
|
+
date: 2013-03-25 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|