diff options
author | Peter Kozak <spag@golwen.net> | 2013-06-13 11:17:04 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-06-13 11:17:04 +0200 |
commit | 7239e1a3d03b2608265f7bf813bd1e5fb9b06f11 (patch) | |
tree | 0643e365e79f617f7f9f43eb216c04a3d99d6058 /app/models/tenant.rb | |
parent | 9eda553c60ab8b165ebd474778845bdacb6333a6 (diff) |
tenant_user methods added
Diffstat (limited to 'app/models/tenant.rb')
-rw-r--r-- | app/models/tenant.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/tenant.rb b/app/models/tenant.rb index 7ed14c7..c70ec32 100644 --- a/app/models/tenant.rb +++ b/app/models/tenant.rb @@ -214,6 +214,14 @@ class Tenant < ActiveRecord::Base self.array_of_available_internal_extensions + self.array_of_available_dids end + def tenant_user_sip_accounts + SipAccount.where('(sip_accountable_type = "Tenant" AND sip_accountable_id = ?) OR (sip_accountable_type = "User" AND sip_accountable_id IN (?))', self.id, self.users.pluck(:id)) + end + + def tenant_user_phones + Phone.where('(phoneable_type = "Tenant" AND phoneable_id = ?) OR (phoneable_type = "User" AND phoneable_id IN (?))', self.id, self.users.pluck(:id)) + end + private # Create a public phone book for this tenant |