Sha256: 789c7700d64ab904b68803b390999cdcd70dc5951261877f5ae652cf440c5890
Contents?: true
Size: 867 Bytes
Versions: 6
Compression:
Stored size: 867 Bytes
Contents
# encoding: utf-8 if defined?(ActiveRecord) module Rubymisc module ArValidates def validates_url(attribute = :url) validates_presence_of attribute validates_length_of attribute, :minimum => 12 validates_format_of attribute, :with => Regex.url, :message => %/isn't a valid URL./ end def validates_email(attribute = :email) validates_presence_of attribute validates_length_of attribute, :minimum => 5 validates_format_of attribute, :with => Regex.email, :message => %/isn't a valid email./ end def validates_image_url(attribute = :image_url) validates attribute, allow_blank: true, format: { with: %r{\.(gif|jpg|png)$}i, message: 'must be a URL for GIF, JPG or PNG image.' } end end ActiveRecord::Base.extend ArValidates end end
Version data entries
6 entries across 6 versions & 1 rubygems