Extract methods to get tenant subfolder/file paths

We were using the same logic in many different places, so we're
simplifying the code. I'm not convinced about the method names, though,
so we might change them in the future.

Note using this method for the default tenant in the `TenantDiskService`
class resulted in a `//` in the path, which is probably harmless but
very ugly and it also generates a different key than the one we got
until now. I've added an extra test to make sure that isn't the case.
This commit is contained in:
Javi Martín
2022-10-19 20:18:06 +02:00
parent 2f312bf474
commit edd47877c2
6 changed files with 17 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ module ActiveStorage
if Tenant.default?
super
else
super.sub(root, File.join(root, "tenants", Tenant.current_schema))
super.sub(root, File.join(root, Tenant.subfolder_path))
end
end
end