Module: SmsOnRails::ModelSupport::PhoneNumber

Included in:
PhoneNumber
Defined in:
lib/sms_on_rails/model_support/phone_number.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/sms_on_rails/model_support/phone_number.rb', line 4

def self.included(base)
  base.send :include,InstanceMethods
  base.send :extend, ClassMethods
  base.send :validates_format_of, :phone_number_digits, :with => /^\d{5,30}$/, :message => 'must be a number and have at least 5 digits'
  base.before_save {|record| record.number = record.digits}
  base.send :validates_presence_of, :number
  base.send :attr_reader, :original_number
  base.class_attribute :valid_finder_create_options
  base.valid_finder_create_options = %w(create keep_duplicates skip_sort)
end