Sha256: 44b44e2592ca760742c5ad5dcd5be7773fd36dfebb98caaa418a706893b4155e

Contents?: true

Size: 242 Bytes

Versions: 10

Compression:

Stored size: 242 Bytes

Contents

module Proposal
  class EmailValidator < ActiveModel::Validator

    def validate record
      unless record.email =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
        record.errors.add :email, "is not valid"
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
proposal-2.0.2 app/validators/proposal/email_validator.rb
proposal-2.0.1 app/validators/proposal/email_validator.rb
proposal-2.0.0 app/validators/proposal/email_validator.rb
proposal-1.0.0 app/validators/proposal/email_validator.rb
proposal-0.0.6 app/validators/proposal/email_validator.rb
proposal-0.0.5 app/validators/proposal/email_validator.rb
proposal-0.0.4 app/validators/proposal/email_validator.rb
proposal-0.0.3 app/validators/proposal/email_validator.rb
proposal-0.0.2 app/validators/proposal/email_validator.rb
proposal-0.0.1 app/validators/proposal/email_validator.rb