summaryrefslogtreecommitdiff
path: root/app/models/route_element.rb
blob: d3302ea9daeefd836e9dc7eb05c3a899772f6dea (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 = ['match', 'not_match', 'set_route_var', 'set_header']

  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