Module: Numero::Rails::Validations
- Defined in:
- lib/numero/rails/validations.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/numero/rails/validations.rb', line 5 def self.included(base) base.class_eval do # Rails 1-2 if Numero::Rails.major < 3 validates_presence_of :number validates_numericality_of :number, :allow_blank => true validates_format_of :number, :with => Numero::VALID_PHONE_NUMBER # Rails 3 else validates :number, :presence => true, :numericality => { :allow_blank => true }, :format => { :with => Numero::VALID_PHONE_NUMBER } end end end |