effective_resources 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/validators/email_cc_validator.rb +15 -0
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b99e4e97fc17bdd6d06ef1ab5c726b23a8697906123537da8d2b72c5ea83a7
|
4
|
+
data.tar.gz: 040d8d9d90165d0582f4ac50390214ad942f5faf9a287782b103dd30048988c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc405eda869d37fb5669365c7acfbbaab2af111802b57b3753372b2eb684e905de07e6ace209ec412016fd8a713f4ce125761b55985408b5085fcf24c8e679eb
|
7
|
+
data.tar.gz: a289eb14cc256be32c392fdd6f9497cb03367bce59bc17c611a8dc6e8b5f2d72694e301826e3186abf82dd216773dd2a61d663db5b19f80d4c1d645ace341af7
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# An ActiveRecord validator for any email field that you would use with effective_email or otherwise
|
2
|
+
#
|
3
|
+
# validates :cc, email_cc: true
|
4
|
+
|
5
|
+
class EmailCcValidator < ActiveModel::EachValidator
|
6
|
+
PATTERN = /\A.+@.+\..+\Z/
|
7
|
+
|
8
|
+
def validate_each(record, attribute, value)
|
9
|
+
if value.present?
|
10
|
+
unless value.to_s.split(',').all? { |email| PATTERN =~ email }
|
11
|
+
record.errors.add(attribute, 'is invalid')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- app/models/effective/resources/paths.rb
|
72
72
|
- app/models/effective/resources/relation.rb
|
73
73
|
- app/models/effective/resources/sql.rb
|
74
|
+
- app/models/validators/email_cc_validator.rb
|
74
75
|
- app/models/validators/email_validator.rb
|
75
76
|
- app/models/validators/url_validator.rb
|
76
77
|
- app/views/application/_flash.html.haml
|