summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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