Files
flagship/app/models/phone_number.rb

12 lines
283 B
Ruby

class PhoneNumber < ApplicationRecord
belongs_to :contact
enum :type, {
mobile: 0,
home: 1,
work: 2,
fax: 3,
other: 4
}, _prefix: true
validates :number, presence: true, format: { with: /\A\+?[0-9\s\-()]+\z/, message: "must be a valid phone number" }
end