valid_email 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/README.md +2 -2
- data/config/locales/en.yml +2 -2
- data/config/locales/fr.yml +2 -2
- data/lib/valid_email/email_validator.rb +1 -1
- data/lib/valid_email/mx_validator.rb +1 -1
- data/lib/valid_email/version.rb +1 -1
- metadata +18 -11
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create ruby-1.9.2@email_validator
|
data/README.md
CHANGED
@@ -34,10 +34,10 @@ In your code :
|
|
34
34
|
|
35
35
|
You can check if email domain has MX record :
|
36
36
|
|
37
|
-
validates :email, :email => {:mx => true}
|
37
|
+
validates :email, :email => {:mx => true, :message => I18n.t('validations.errors.models.user.invalid_email')}
|
38
38
|
|
39
39
|
Or
|
40
|
-
validates :email, :email =>
|
40
|
+
validates :email, :email => {:message => I18n.t('validations.errors.models.user.invalid_email')}, :mx => {:message => I18n.t('validations.errors.models.user.invalid_mx')}
|
41
41
|
|
42
42
|
|
43
43
|
If you don't want the MX validator stuff, just require the right file
|
data/config/locales/en.yml
CHANGED
data/config/locales/fr.yml
CHANGED
@@ -23,6 +23,6 @@ class EmailValidator < ActiveModel::EachValidator
|
|
23
23
|
rescue Exception => e
|
24
24
|
r = false
|
25
25
|
end
|
26
|
-
record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "
|
26
|
+
record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "valid_email.validations.email")) unless r
|
27
27
|
end
|
28
28
|
end
|
@@ -10,7 +10,7 @@ class MxValidator < ActiveModel::EachValidator
|
|
10
10
|
mx.concat dns.getresources(m.domain, Resolv::DNS::Resource::IN::MX)
|
11
11
|
end
|
12
12
|
r = mx.size > 0
|
13
|
-
record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "
|
13
|
+
record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "valid_email.validations.email")) unless r
|
14
14
|
r
|
15
15
|
end
|
16
16
|
end
|
data/lib/valid_email/version.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
ValidEmailVersion = "0.0.
|
1
|
+
ValidEmailVersion = "0.0.4"
|
2
2
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valid_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-23 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &13116240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *13116240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &13115440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *13115440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mail
|
38
|
-
requirement: &
|
38
|
+
requirement: &13111340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *13111340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activemodel
|
49
|
-
requirement: &
|
49
|
+
requirement: &13110020 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *13110020
|
58
58
|
description: ActiveModel Validation for email
|
59
59
|
email:
|
60
60
|
- hery@rails-royce.org
|
@@ -63,6 +63,7 @@ extensions: []
|
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
65
|
- .gitignore
|
66
|
+
- .rvmrc
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE
|
68
69
|
- README.md
|
@@ -89,15 +90,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
90
|
- - ! '>='
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: -4220609047833708671
|
92
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
97
|
none: false
|
94
98
|
requirements:
|
95
99
|
- - ! '>='
|
96
100
|
- !ruby/object:Gem::Version
|
97
101
|
version: '0'
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
hash: -4220609047833708671
|
98
105
|
requirements: []
|
99
106
|
rubyforge_project: valid_email
|
100
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.15
|
101
108
|
signing_key:
|
102
109
|
specification_version: 3
|
103
110
|
summary: ActiveModel Validation for email
|