acts_as_multi_tenant 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f798021b2f0d018f7487922f84044db2b9ef1ea6e961ac134fe7cf602774119
4
- data.tar.gz: c438ed78359432b8ac602e0c080304b14cf3ed5100e959de379f3d407b6e2a36
3
+ metadata.gz: 26a8ef7c3b1a76744faf76e309dcdc4a25dd33f176901d6c7f5d2e4449efd565
4
+ data.tar.gz: 912f63a0d4d1c644cc6677abad34fe36a462c718cd4379e3747e90d6a49c7d3a
5
5
  SHA512:
6
- metadata.gz: 3cfb7bac41361b0c3c5840ec510e571f513e6addef721f85f5d3f414cd9ba8c943f8de73f105f27b4ef5e88600af63078fbfebeb9d53486c9cecfb4ea30c8c88
7
- data.tar.gz: e7406e359b33dd5159ab0f2acfdfab721e1d7dcb5d4717f506cfe77396cd5deb3b6803df7924a45062fc58922197a835ffe8c0c7608c415c465d18a522be362b
6
+ metadata.gz: 8b621db0e296a39b21bc9d76cbe0b4ac19cf66f08b58bd107c5fbbb942419faaa7a2e86d3a03f56d3d39cfeb29c7e2098fcdd8d61de632bec766a8e9565cd354
7
+ data.tar.gz: f220cb3dc9819b565a1423695f9ca3350b07aa26b0e776a96a863eddb4479dd4340aa4efba32deb1f7ca4780b53d0761111869a3aabfd4a408df09e63469fe55
@@ -65,8 +65,11 @@ module MultiTenant
65
65
  current = self.class.tenant_class.current_tenants
66
66
 
67
67
  if current.size == 1 or current.map(&code_col).uniq.size == 1
68
- current_tenant_id = self.class.tenant_class.current_tenants.first.send(self.class.tenant_primary_key)
69
- send "#{self.class.tenant_foreign_key}=", current_tenant_id
68
+ tenant_fkey = self.class.tenant_foreign_key
69
+ if send(tenant_fkey).nil? or !current.map(&self.class.tenant_primary_key).include? send(tenant_fkey)
70
+ current_tenant_id = self.class.tenant_class.current_tenants.first.send(self.class.tenant_primary_key)
71
+ send "#{tenant_fkey}=", current_tenant_id
72
+ end
70
73
  end
71
74
  end
72
75
 
@@ -1,4 +1,4 @@
1
1
  module MultiTenant
2
2
  # Gem version
3
- VERSION = '2.3.0'.freeze
3
+ VERSION = '2.3.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_multi_tenant
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Hollinger
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-06-23 00:00:00.000000000 Z
13
+ date: 2019-08-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord