diff options
author | spag <spag@golwen.net> | 2012-12-27 14:09:53 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2012-12-27 14:09:53 +0100 |
commit | b76b13bff13cd6bcb2d543386cae9868cd4d882f (patch) | |
tree | 776c5735cdb4d162b8085c52fabd88bb1f8f2b13 /app/controllers | |
parent | 98fe29192d3fb3f79ad8913b73c89b6e7f234eb4 (diff) |
Fallback sip account in phone views
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/phones_controller.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 0b765e8..b865cb1 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -13,6 +13,8 @@ class PhonesController < ApplicationController end def new + used_sip_account_ids = Phone.where('fallback_sip_account_id IS NOT NULL').collect {|r| r.fallback_sip_account } + @fallback_sip_accounts = SipAccount.where('sip_accountable_type = "Tenant" AND id NOT IN (?)', used_sip_account_ids).all @phone = @phoneable.phones.build() # Use the last phone.phone_model as the default. # @@ -34,6 +36,8 @@ class PhonesController < ApplicationController end def edit + used_sip_account_ids = Phone.where('fallback_sip_account_id IS NOT NULL AND id != ?', @phone.id).collect {|r| r.fallback_sip_account_id } + @fallback_sip_accounts = SipAccount.where('sip_accountable_type = "Tenant" AND id NOT IN (?)', used_sip_account_ids).all end def update |