Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/multitenancy/model_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ModelExtensions

module ClassMethods

def acts_as_tenant(tenant_id, sub_tenant_id=nil)
def acts_as_tenant(tenant_id, sub_tenant_id=nil, disable_tenant_scope = false)
raise "tenant_id can't be nil! [Multitenancy]" unless tenant_id

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in future there are chances that people start ignoring tenant id header assuming tenant scope is false. This line might cause an issue.


def self.is_scoped_by_tenant?
Expand All @@ -32,7 +32,7 @@ def self.is_scoped_by_tenant?
tenant = Multitenancy.current_tenant
if tenant && tenant.tenant_id
conditions = {}
conditions[tenant_id] = tenant.tenant_id
conditions[tenant_id] = tenant.tenant_id unless disable_tenant_scope
conditions[sub_tenant_id] = tenant.sub_tenant_id if sub_tenant_id && tenant.sub_tenant_id
where(conditions)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/multitenancy/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Multitenancy
VERSION = "0.0.5"
# This is a patched version built out of branch disabling_tenant to avoid searching entities with tenant_id(while making select queries)
VERSION = "0.0.6.patched"
end