summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/phone.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/phone.rb b/app/models/phone.rb
index 1f3c497..a606834 100644
--- a/app/models/phone.rb
+++ b/app/models/phone.rb
@@ -20,6 +20,7 @@ class Phone < ActiveRecord::Base
# Validations
#
before_validation :sanitize_mac_address
+ before_validation :destroy_fallback_sip_account_if_not_hot_deskable
validates_presence_of :mac_address
validate_mac_address :mac_address
@@ -227,5 +228,11 @@ class Phone < ActiveRecord::Base
self.last_ip_address = nil
end
end
+
+ def destroy_fallback_sip_account_if_not_hot_deskable
+ if !self.hot_deskable?
+ self.fallback_sip_account_id = nil
+ end
+ end
end