simplificator-arext 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -0
- data/lib/arext/validations.rb +4 -0
- metadata +2 -2
data/README
CHANGED
@@ -24,6 +24,9 @@ portnumbers and any subdomains. Instead of a domain name, you can use ip address
|
|
24
24
|
This validator adds the feature to validate a hostname. Instead of a hostname, you can
|
25
25
|
use ip address too (version 4).
|
26
26
|
|
27
|
+
== validates_email
|
28
|
+
This validator adds the feature to validate a email address.
|
29
|
+
|
27
30
|
|
28
31
|
Example
|
29
32
|
=======
|
@@ -41,6 +44,10 @@ in your ActiveRecord class:
|
|
41
44
|
in your ActiveRecord class:
|
42
45
|
validates_host(:attribute)
|
43
46
|
|
47
|
+
== validates_email
|
48
|
+
in your ActiveRecord class:
|
49
|
+
validates_email(:attribute)
|
50
|
+
|
44
51
|
|
45
52
|
|
46
53
|
Copyright (c) 2008 [simplificator gmbh], released under the MIT license
|
data/lib/arext/validations.rb
CHANGED
@@ -15,6 +15,10 @@ module Arext
|
|
15
15
|
validates_format_of(attribute, :with => /^(#{VALID_HOST}\.#{VALID_TLD}|#{VALID_IP})$/)
|
16
16
|
end
|
17
17
|
|
18
|
+
def validates_email(attribute)
|
19
|
+
validates_format_of(attribute, :with => /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,5})+$/)
|
20
|
+
end
|
21
|
+
|
18
22
|
|
19
23
|
def validates_constraints(*attrs)
|
20
24
|
attrs = column_names if attrs.blank?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplificator-arext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simplificator GmbH
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09
|
12
|
+
date: 2008-10-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|