summaryrefslogtreecommitdiff
path: root/app/models/route_element.rb
blob: 32f730d7f64e80d62fc843e1d01fff817fa82983 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 :var_in,
            :presence => true

  validates :pattern,
            :presence => true

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


  def to_s
    "#{var_in} #{var_out}"
  end

end