Sha256: a6a903b84f375c2a01c3620c3bce565efbec2e03f1fbb0fe2d30fa3eb0a52298

Contents?: true

Size: 255 Bytes

Versions: 5

Compression:

Stored size: 255 Bytes

Contents

class EmailValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
      record.errors[attribute] << (options[:message] || 'is not an email')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise_token_auth-0.1.32.beta10 app/validators/email_validator.rb
devise_token_auth-0.1.32.beta9 app/validators/email_validator.rb
devise_token_auth-0.1.32.beta8 app/validators/email_validator.rb
devise_token_auth-0.1.32.beta7 app/validators/email_validator.rb
devise_token_auth-0.1.32.beta6 app/validators/email_validator.rb