From d6a733440eee34dab3daf25089d40aed91018a49 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 4 Apr 2013 12:04:34 +0200 Subject: Limit the amount of displayed phone_numbers in a switchboard_entry --- app/models/switchboard.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models') 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 -- cgit v1.2.3