simple_activemodel_validators 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 485ce64d3146c9e49b0cfabdb259ae91db30f107
|
4
|
+
data.tar.gz: 80abfb92a5bf4861941d471041c23975c3f3cb60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1b3d7b5e4c09f58a312a24a6caa8f232175c6c599ff71250b411cd568ecc604cfb8bfb67087e15bfa41c5e7fb5ef2bb51a20af717d32918f972281e06a9427
|
7
|
+
data.tar.gz: 175c9ef204d99f66ec7ad1be2751db2da31fe33a43bc7f838367a3d22e3a128f8da4e99a9bd917082cd3841887135bbb413f701bd0bd0d9fd5a0e013a7af6a72
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
[](https://travis-ci.org/decomplect-io/simple_activemodel_validators)
|
2
|
+
[](https://codeclimate.com/github/decomplect-io/simple_activemodel_validators)
|
2
3
|
# Simple ActiveModel Validators
|
3
4
|
|
4
5
|
A collection of ActiveModel validators that don't pollute the global namespace.
|
@@ -22,10 +22,13 @@ module SimpleActiveModelValidators
|
|
22
22
|
# [1]: http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_associated
|
23
23
|
class AssociatedBubblingValidator < ActiveModel::EachValidator
|
24
24
|
# Implements the contract of `ActiveModel::EachValidator`
|
25
|
+
# @param record The record being validated
|
26
|
+
# @param attribute The name of the attribute being validated
|
27
|
+
# @param values The value of the attribute
|
25
28
|
# @return nil
|
26
29
|
def validate_each(record, attribute, values)
|
27
30
|
# values can be an array or a scalar
|
28
|
-
[values].flatten.reject(&:valid?).each do |value|
|
31
|
+
[values].flatten.compact.reject(&:valid?).each do |value|
|
29
32
|
record.errors.add(attribute, value.errors.messages)
|
30
33
|
end
|
31
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_activemodel_validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Decomplect Software LLP
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|