Class: Congo::Types::Email

Inherits:
String
  • Object
show all
Defined in:
lib/congo/types.rb

Class Method Summary collapse

Class Method Details

.apply(klass, scope, name) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/congo/types.rb', line 6

def self.apply(klass, scope, name)
  klass.class_eval do
    validates_format_of name.to_sym, 
      :with => /\A[\w\._%-]+@[\w\.-]+\.[a-zA-Z]{2,4}\z/,
      :message => lambda { I18n.t('congo.errors.messages.invalid') }
  end
end