activerecord-multi-tenant 1.0.3 → 1.0.4

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: b3b3e919bcbd114ed5158b9532a28338ef32dd84ebc618d0b43a0d7758228c1c
4
- data.tar.gz: c6b27ea4f4a18c45c5280b264d586aa97e9fc68bc6b9e09bcfda03976ecf7416
3
+ metadata.gz: 4ba6283cdc0a3a6156de1ed6e48674650769dd98a563175e3f0f6ad145e948a1
4
+ data.tar.gz: 4e60b1920f1b14a6707adf28fbd15135830a46a8085c07912fb5b190d7b677e9
5
5
  SHA512:
6
- metadata.gz: 4904fbc68420aeb50c90176c13559fe1270a02266195a69b735d3bafb8d38307e411bb811e3e278164903bfdccd4f8ad115029ff101f51faa56cb66689c8928e
7
- data.tar.gz: ac167e7a648a6f877407a8662e9e06ae70fa802f3b7314f62ffe4396d51d4111302a9edfc9d7cbdda5c9611e71bee95b70396518a32364133bedd3e75664a908
6
+ metadata.gz: 84f4b35e8525f88193b08c719abce5c75d085bbfca9f517cc090d0a604cd435a23bf565c66e91c1cae30e45c06c92d7407829a0659a88843757baa54e0e6dd49
7
+ data.tar.gz: 3495d94157cc8dc9528d55405eca44fd7c077fbd06bf841b915cc02e8d2940abff626d652802ff15b23f8a9192d8af76cbd038128be1a2a0369fba2f213458d0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## 1.0.4 2019-10-30
5
+
6
+ * Fix bug introduced in 1.0.3 for delete when table is reference or not distributed
7
+
8
+
9
+ ## 1.0.3 2019-10-28
10
+
11
+ * Ensure that when using object.delete, we set the tenant
12
+
13
+
4
14
  ## 1.0.2 2019-09-20
5
15
 
6
16
  * Compatibility with rails 6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.3)
4
+ activerecord-multi-tenant (1.0.4)
5
5
  rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
@@ -3,7 +3,7 @@ module ActiveRecord
3
3
  alias :delete_orig :delete
4
4
 
5
5
  def delete
6
- if persisted? && MultiTenant.current_tenant_id.nil?
6
+ if MultiTenant.multi_tenant_model_for_table(self.class.table_name).present? && persisted? && MultiTenant.current_tenant_id.nil?
7
7
  MultiTenant.with(self.public_send(self.class.partition_key)) { delete_orig }
8
8
  else
9
9
  delete_orig
@@ -1,3 +1,3 @@
1
1
  module MultiTenant
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -52,7 +52,20 @@ describe MultiTenant, 'Record modifications' do
52
52
  MultiTenant.with(account2) do
53
53
  expect(Project.where(id: project2.id).first).to be_present
54
54
  end
55
+ end
56
+
57
+ it 'test delete for reference tables' do
58
+ category1 = Category.create! name: 'Category 1'
59
+ expect(Category.count).to eq(1)
60
+ category1.delete
61
+ expect(Category.count).to eq(0)
62
+ end
55
63
 
64
+ it 'test delete for non distributed tables' do
65
+ unscoped = UnscopedModel.create! name: 'Canada'
66
+ expect(UnscopedModel.count).to eq(1)
67
+ unscoped.delete
68
+ expect(UnscopedModel.count).to eq(0)
56
69
  end
57
70
 
58
71
  it 'includes the tenant_id in UPDATEs' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-multi-tenant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Citus Data
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: request_store