summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 11:34:36 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-30 11:34:36 +0100
commite03b0b57f4c05210d198e2fab031cb4b7bdd5247 (patch)
tree6793a1d3a9090f3e656cf3912f20bff7184f74f3
parent544ea50a66da81989d0320735724bd09786be8ea (diff)
Added destroy_fallback_sip_account_if_not_hot_deskable
-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