summaryrefslogtreecommitdiff
path: root/app/models/gateway_header.rb
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-08-03 11:26:58 +0200
committerPeter Kozak <spag@golwen.net>2013-08-03 11:26:58 +0200
commit90cbcb804676d70f0f6681ee50913221f387ad8a (patch)
treefc802661d6109fb5e4aa9b9041e23a827ff5a593 /app/models/gateway_header.rb
parent0bca4fde90142a598b348f6cbd12dd6bb32b6adc (diff)
gateway_headers model added
Diffstat (limited to 'app/models/gateway_header.rb')
-rw-r--r--app/models/gateway_header.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/models/gateway_header.rb b/app/models/gateway_header.rb
new file mode 100644
index 0000000..638bd8d
--- /dev/null
+++ b/app/models/gateway_header.rb
@@ -0,0 +1,24 @@
+class GatewayHeader < ActiveRecord::Base
+ HEADER_TYPES = [
+ 'invite',
+ # 'provisional',
+ # 'request',
+ # 'bye',
+ ]
+
+ attr_accessible :gateway_id, :header_type, :constraint_source, :constraint_value, :name, :value, :description
+
+ belongs_to :gateway, :touch => true
+
+ validates :name,
+ :presence => true,
+ :uniqueness => {:scope => [:gateway_id, :header_type, :constraint_source, :constraint_value]}
+
+ validates :header_type,
+ :presence => true,
+ :inclusion => { :in => HEADER_TYPES }
+
+ def to_s
+ name
+ end
+end