Sha256: 9f2c92f3dbd4ce3b48668bf42ec934c308e516b0a9ec15767cdfcec625da4f75
Contents?: true
Size: 516 Bytes
Versions: 2
Compression:
Stored size: 516 Bytes
Contents
class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add attribute, (options[:message] || "is not a valid email") unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i end end module Whodat class User < ApplicationRecord has_secure_password validates :email, presence: true, uniqueness: true, email: true validates :name, :password_digest, presence: true validates :password, length: { minimum: 8 }, on: :create end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whodat-1.0.1 | app/models/whodat/user.rb |
whodat-1.0.0 | app/models/whodat/user.rb |