Sha256: e1ba801bbca8a92f46efcabeb16f9be3a6c35ad91c39104dc0f1a518fb49d630

Contents?: true

Size: 391 Bytes

Versions: 1

Compression:

Stored size: 391 Bytes

Contents

# encoding: utf-8

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] || "введен не верно")
    end
  end
end

module ConstructorCap
  class Email < ActiveRecord::Base
    validates :email, :email => true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
constructor-cms-0.2.1 cap/app/models/constructor_cap/email.rb