Sha256: 8dd2817c9419df12ae66fd59111b1f39fe20981bdbe50af602216014fc751c7b

Contents?: true

Size: 264 Bytes

Versions: 8

Compression:

Stored size: 264 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] || I18n.t("errors.not_email"))
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
devise_token_auth-0.1.37.beta3 app/validators/email_validator.rb
devise_token_auth-0.1.37.beta2 app/validators/email_validator.rb
devise_token_auth-0.1.37.beta1 app/validators/email_validator.rb
devise_token_auth-0.1.36 app/validators/email_validator.rb
devise_token_auth-0.1.35 app/validators/email_validator.rb
devise_token_auth-0.1.34 app/validators/email_validator.rb
devise_token_auth-0.1.33 app/validators/email_validator.rb
devise_token_auth-0.1.32 app/validators/email_validator.rb