summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2012-12-28 12:07:58 +0100
committerspag <spag@golwen.net>2012-12-28 12:07:58 +0100
commit8dad9594fbcc8c236a350266c4538a92eeae2772 (patch)
tree3708d568ad06a28dde1b09fc77b7c35ab30f56aa
parent43199a00bcb0cc93775a3e3b71abea476a33a1a7 (diff)
fallback_sip_account_id should be unique
-rw-r--r--app/models/phone.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/phone.rb b/app/models/phone.rb
index f78ebe2..9e5766a 100644
--- a/app/models/phone.rb
+++ b/app/models/phone.rb
@@ -32,6 +32,8 @@ class Phone < ActiveRecord::Base
validates_presence_of :phone_model
validates_presence_of :phoneable
+
+ validates_uniqueness_of :fallback_sip_account_id
before_save :save_last_ip_address
before_save :destroy_phones_sip_accounts_if_phoneable_changed