diff options
author | spag <spag@golwen.net> | 2013-01-13 20:28:46 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-01-13 20:28:46 +0100 |
commit | f10b264bbae53a7128b22c385201161d21a9000f (patch) | |
tree | 11c36158c6e8ca2f971bcbc4fccf3f61bd0ea03c | |
parent | 2e8f2f2b51303ad1ad677a606e877b1fd3d7219b (diff) |
validations
-rw-r--r-- | app/models/gateway.rb | 11 |
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 |