summaryrefslogtreecommitdiff
path: root/app/models/route_element.rb
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-17 07:44:01 +0100
committerspag <spag@golwen.net>2013-01-17 07:44:01 +0100
commit85d8dc12c3963f78ea1db4089c6ff2fa6ec205e9 (patch)
treeb63f40981ce3f8ac34a978d856ee17a5ee86c7bf /app/models/route_element.rb
parent1d18e9d7fc16501d7622889df9d6ef05c75adb2f (diff)
validations
Diffstat (limited to 'app/models/route_element.rb')
-rw-r--r--app/models/route_element.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/route_element.rb b/app/models/route_element.rb
index 6f6fd3f..d3302ea 100644
--- a/app/models/route_element.rb
+++ b/app/models/route_element.rb
@@ -1,10 +1,23 @@
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