diff options
author | spag <spag@golwen.net> | 2012-12-31 08:50:27 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2012-12-31 08:50:27 +0100 |
commit | aed84444142604a62e37e57acfaaf957219e2c8d (patch) | |
tree | e00b1f5844590393171e0bc839ab516d39f5144d /app/controllers/phones_controller.rb | |
parent | c24bd3a8212e85894b2f7c26e190fe5e89fbaaf2 (diff) | |
parent | 12c8f4c82770ded6ea6b519e4451ed6757419ddf (diff) |
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app/controllers/phones_controller.rb')
-rw-r--r-- | app/controllers/phones_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index f1dcd3e..2698465 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -13,9 +13,9 @@ class PhonesController < ApplicationController end def new - set_fallback_sip_accounts - @phone = @phoneable.phones.build() + + set_fallback_sip_accounts # Use the last phone.phone_model as the default. # @@ -80,6 +80,9 @@ class PhonesController < ApplicationController def set_fallback_sip_accounts used_sip_account_ids = Phone.where(:fallback_sip_account_id => SipAccount.pluck(:id)).pluck(:fallback_sip_account_id) @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant').where(:hotdeskable => true) - SipAccount.where(:id => used_sip_account_ids) + if @phone && !@phone.fallback_sip_account_id.blank? && SipAccount.exists?(@phone.fallback_sip_account_id) + @fallback_sip_accounts << SipAccount.where(:id => @phone.fallback_sip_account_id).first + end end end |