Module: Twilio::Rails::HasPhoneNumber
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/twilio/rails/concerns/has_phone_number.rb
Overview
Provides validations and reformatting on validation for a model that has an attribute phone_number
that is
that is unique and that matches Formatter.coerce_to_valid_phone_number.
Instance Method Summary collapse
Instance Method Details
#reformat_phone_number ⇒ Object
15 16 17 18 19 20 |
# File 'lib/twilio/rails/concerns/has_phone_number.rb', line 15 def reformat_phone_number current = Twilio::Rails::Formatter.coerce_to_valid_phone_number(phone_number) self.phone_number = current if current true end |
#valid_north_american_phone_number? ⇒ Boolean
22 23 24 |
# File 'lib/twilio/rails/concerns/has_phone_number.rb', line 22 def valid_north_american_phone_number? Twilio::Rails::Formatter.valid_north_american_phone_number?(phone_number) end |