summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-13 20:28:46 +0100
committerspag <spag@golwen.net>2013-01-13 20:28:46 +0100
commitf10b264bbae53a7128b22c385201161d21a9000f (patch)
tree11c36158c6e8ca2f971bcbc4fccf3f61bd0ea03c /app/models
parent2e8f2f2b51303ad1ad677a606e877b1fd3d7219b (diff)
validations
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gateway.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index 6a7514c..72cf72c 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -1,6 +1,17 @@
class Gateway < ActiveRecord::Base
+ TECHNOLOGIES = ['sip']
+
attr_accessible :name, :technology, :inbound, :outbound, :description
has_many :gateway_settings, :dependent => :destroy
has_many :gateway_parameters, :dependent => :destroy
+
+ validates :name,
+ :presence => true,
+ :uniqueness => true
+
+ validates :technology,
+ :presence => true,
+ :inclusion => { :in => TECHNOLOGIES }
+
end