summaryrefslogtreecommitdiff
path: root/app/models/switchboard.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-04 12:04:34 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-04-04 12:04:34 +0200
commitd6a733440eee34dab3daf25089d40aed91018a49 (patch)
tree632e46e34a4338a6e3b4f7cb2c29c123f50a4ea9 /app/models/switchboard.rb
parentcea2cc3c1cc1e48fc4600c698d52dfda2bde4505 (diff)
Limit the amount of displayed phone_numbers in a switchboard_entry
Diffstat (limited to 'app/models/switchboard.rb')
-rw-r--r--app/models/switchboard.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/switchboard.rb b/app/models/switchboard.rb
index 53f69a4..cf8c708 100644
--- a/app/models/switchboard.rb
+++ b/app/models/switchboard.rb
@@ -18,6 +18,12 @@ class Switchboard < ActiveRecord::Base
:less_than => 5
}
+ validates :amount_of_displayed_phone_numbers,
+ :numericality => { :only_integer => true,
+ :greater_than_or_equal_to => 0,
+ :less_than => 20
+ }
+
belongs_to :user, :touch => true
has_many :switchboard_entries, :dependent => :destroy
has_many :sip_accounts, :through => :switchboard_entries