summaryrefslogtreecommitdiff
path: root/app/models/route_element.rb
blob: 324a26d3bb428fccbc595ed2ec82073be59ec5b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class RouteElement < ActiveRecord::Base
  ELEMENT_ACTIONS = ['none', 'match', 'not_match', 'set']

  attr_accessible :call_route_id, :var_in, :var_out, :pattern, :replacement, :action, :mandatory, :position

  belongs_to :call_route

  acts_as_list :scope => :call_route

  validates :action,
            :presence => true,
            :inclusion => { :in => ELEMENT_ACTIONS }


  def to_s
    "#{pattern} => #{var_in} #{var_out}"
  end

end