panda_pal 5.12.2 → 5.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/panda_pal/organization.rb +5 -0
- data/lib/panda_pal/engine.rb +2 -3
- data/lib/panda_pal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d8ac5de141425606ffd72e020dec815ebacc8fbe840e07c94c7d390fc885f07
|
4
|
+
data.tar.gz: e2eafa4325bff57b66d3b0bba977c0318c5d3a2821d5be3ec20f04324196f2a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4624ae3e064ca1547951a9171503d3e13170d92370b50557f8473e69655fc46b38748e39cfb920990d8a1b9fd38c30c4b7972e8584faafbcf0ea9481cc707794
|
7
|
+
data.tar.gz: db2597130346e0c0afe6739200b61cb14a2c1f8441a038c1cba7426f653e65b987757b94bf2ef22c8d727b712754135d87e0c7c8326371ab5be407a180f8d1ca
|
@@ -71,6 +71,11 @@ module PandaPal
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
def self.for_apt_tenant(schema)
|
75
|
+
shard, schema = Apartment::Tenant.split_tenant(schema)
|
76
|
+
find_by(name: schema)
|
77
|
+
end
|
78
|
+
|
74
79
|
def encryption_key
|
75
80
|
# production environment might not have loaded secret_key_base yet.
|
76
81
|
# In that case, just read it from env.
|
data/lib/panda_pal/engine.rb
CHANGED
@@ -68,15 +68,14 @@ module PandaPal
|
|
68
68
|
|
69
69
|
unless defined?(switch_org)
|
70
70
|
def switch_org(org, &block)
|
71
|
-
org = PandaPal::Organization.
|
71
|
+
org = PandaPal::Organization.for_apt_tenant(org) if org.is_a?(String)
|
72
72
|
org.switch_tenant(&block)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
unless defined?(current_organization)
|
77
77
|
def current_organization
|
78
|
-
|
79
|
-
PandaPal::Organization.find_by_name(org_name)
|
78
|
+
PandaPal::Organization.for_apt_tenant(Apartment::Tenant.current)
|
80
79
|
end
|
81
80
|
end
|
82
81
|
end
|
data/lib/panda_pal/version.rb
CHANGED