active-model-email-validator 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'active-model-email-validator'
3
- s.version = '1.0.1'
3
+ s.version = '1.0.2'
4
4
  s.summary = 'An ActiveModel email validator based on the Mail gem.'
5
5
  s.homepage = 'http://codyrobbins.com/software/active-model-email-validator'
6
6
  s.author = 'Cody Robbins'
@@ -41,11 +41,11 @@ class EmailValidator < ActiveModel::EachValidator
41
41
  end
42
42
 
43
43
  def add_error_to(object, attribute)
44
- object.errors[attribute] << error_message
44
+ object.errors.add(attribute, error_message)
45
45
  end
46
46
 
47
47
  def error_message
48
- options[:message] || 'is not a valid email'
48
+ options[:message] || :email
49
49
  end
50
50
 
51
51
  def parse_address(value)
@@ -64,3 +64,6 @@ class EmailValidator < ActiveModel::EachValidator
64
64
  @address.send(:tree).domain.dot_atom_text.elements.size > 1
65
65
  end
66
66
  end
67
+
68
+ require('active_support/i18n')
69
+ I18n.load_path << File.dirname(__FILE__) + '/email_validator/locale/en.yml'
@@ -0,0 +1,4 @@
1
+ en:
2
+ errors:
3
+ messages:
4
+ email: must be a valid email address
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-model-email-validator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cody Robbins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-02 00:00:00 -04:00
18
+ date: 2011-07-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -61,6 +61,7 @@ files:
61
61
  - README.markdown
62
62
  - active-model-email-validator.gemspec
63
63
  - lib/active-model-email-validator.rb
64
+ - lib/email_validator/locale/en.yml
64
65
  has_rdoc: true
65
66
  homepage: http://codyrobbins.com/software/active-model-email-validator
66
67
  licenses: []