module ActsAsTenant
def self.with_tenant(tenant, &block)
def self.with_tenant(tenant, &block) if block.nil? raise ArgumentError, "block required" end old_tenant = current_tenant self.current_tenant = tenant value = block.call value ensure self.current_tenant = old_tenant end