summaryrefslogtreecommitdiff
path: root/app/models/call_route.rb
blob: f6a3dd32387012fa6ed6e66b309384ca2d82ceba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class CallRoute < ActiveRecord::Base
  ROUTING_TABLES = ['prerouting', 'outbound', 'inbound']

  attr_accessible :table, :name, :endpoint_type, :endpoint_id, :position

  has_many :route_elements, :dependent => :destroy

  validates :name,
  					:presence => true

  validates :table,
            :presence => true,
            :inclusion => { :in => ROUTING_TABLES }

  acts_as_list :scope => '`table` = \'#{table}\''

  def to_s
    name.to_s
  end
end