From f10b264bbae53a7128b22c385201161d21a9000f Mon Sep 17 00:00:00 2001 From: spag Date: Sun, 13 Jan 2013 20:28:46 +0100 Subject: validations --- app/models/gateway.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/models/gateway.rb') 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 -- cgit v1.2.3