diff options
Diffstat (limited to 'app/models/phone_number_range.rb')
-rw-r--r-- | app/models/phone_number_range.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/phone_number_range.rb b/app/models/phone_number_range.rb new file mode 100644 index 0000000..2fdd9b6 --- /dev/null +++ b/app/models/phone_number_range.rb @@ -0,0 +1,16 @@ +class PhoneNumberRange < ActiveRecord::Base + attr_accessible :name, :description + + has_many :phone_numbers, :as => :phone_numberable, :dependent => :destroy + belongs_to :phone_number_rangeable, :polymorphic => true + + validates_presence_of :name + validates_uniqueness_of :name, :scope => [:phone_number_rangeable_id, :phone_number_rangeable_type] + validates_inclusion_of :name, :in => [INTERNAL_EXTENSIONS, DIRECT_INWARD_DIALING_NUMBERS, SERVICE_NUMBERS] + validates_presence_of :phone_number_rangeable_id + validates_presence_of :phone_number_rangeable + + def to_s + name + end +end |