summaryrefslogtreecommitdiff
path: root/app/models/phone_number_range.rb
blob: b66648740a90981eb09899ccef0b29a7ff0b1553 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 => [GsParameter.get('INTERNAL_EXTENSIONS'), GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS'), GsParameter.get('SERVICE_NUMBERS')]
  validates_presence_of :phone_number_rangeable_id
  validates_presence_of :phone_number_rangeable
  
  def to_s
    name
  end
end