Skip to content

Commit

Permalink
Add additional pkeys to scope if given
Browse files Browse the repository at this point in the history
  • Loading branch information
mylesboone committed Oct 30, 2023
1 parent d29185f commit 244fbb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/acts_as_tenant/model_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def acts_as_tenant(tenant = :account, scope = nil, **options)
if ActsAsTenant.current_tenant
keys = [ActsAsTenant.current_tenant.send(pkey)].compact
keys.push(nil) if options[:has_global_records]
if options[:additional_pkeys_method]
keys.push(*ActsAsTenant.current_tenant.send(options[:additional_pkeys_method]))
end

if options[:through]
query_criteria = {options[:through] => {fkey.to_sym => keys}}
Expand Down

0 comments on commit 244fbb5

Please sign in to comment.