Sha256: 3b47bf6e6e300da00f52559e69ac4a99e0d589cbbd059fb7d8d12febc3e32764

Contents?: true

Size: 819 Bytes

Versions: 6

Compression:

Stored size: 819 Bytes

Contents

class Person < ActiveRecord::Base
  validates :phone,            :mask => "(99) 9999-9999", :allow_blank => true
  validates :fax,              :mask => "(99) 9999-9999", :allow_nil => false
  validates :acronym,          :mask => "***", :allow_nil => true
  validates :alphanumeric,     :mask => "aaa999"
  validates :zip_code,         :mask => "99999-999", :allow_blank => false
  validates :birth_date,       :mask => '99/99/9999'
  validates :birth_time,       :mask => '99:99'
  validates :birth_year,       :mask => '9999'
  validates :body_fat,         :mask => "99,99"
  validates :custom,           :mask => :custom_mask, :allow_blank => false
  validates :identification,   :mask => Proc.new{|o| o.proc_mask}, :allow_blank => false

  def custom_mask
    "999.99"
  end

  def proc_mask
    "99.99"
  end
end

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
mask_validator-0.2.3 spec/models/person.rb
mask_validator-0.2.3 spec/support/models/person.rb
mask_validator-0.2.2 spec/models/person.rb
mask_validator-0.2.2 spec/support/models/person.rb
mask_validator-0.2.1 spec/models/person.rb
mask_validator-0.2.1 spec/support/models/person.rb