serverkit 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/at_least_one_of_validator.rb +12 -0
- data/lib/serverkit/resources/base.rb +1 -0
- data/lib/serverkit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40403ed3991e3dae313836b16ffe5ad523e9e924
|
4
|
+
data.tar.gz: 4520aaaff4ab249b9835f0a86cdd9356a629dfe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3e9191d02228ea58997d78de98362e1e5da3aebc41cc1617e77088336db9753684886e973768d1b363dccc8112a80eb07f6940cf2cb2c5822fab0d8a149db1
|
7
|
+
data.tar.gz: 8524cc26214791599b074d18d98e19c06da654b9c90c32c7575009cfc64eb25a53f3936f0d797f4f489d538a04bd5e0c0feb7900fe243390de0a7b46340b2212
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "active_model"
|
2
|
+
require "active_support/core_ext/array/conversions"
|
3
|
+
require "active_support/core_ext/object/try"
|
4
|
+
|
5
|
+
class AtLeastOneOfValidator < ActiveModel::EachValidator
|
6
|
+
def validate_each(record, attribute, value)
|
7
|
+
attributes = options[:in] + [attribute]
|
8
|
+
if attributes.all? { |name| record.try(name).nil? }
|
9
|
+
record.errors.add(attribute, "is required because at least one of #{attributes.to_sentence} are required")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/serverkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -240,6 +240,7 @@ files:
|
|
240
240
|
- images/server-colored.png
|
241
241
|
- images/server-small.png
|
242
242
|
- images/server.png
|
243
|
+
- lib/at_least_one_of_validator.rb
|
243
244
|
- lib/readable_validator.rb
|
244
245
|
- lib/regexp_validator.rb
|
245
246
|
- lib/required_validator.rb
|