mongoid-multitenancy 1.1.1 → 1.1.2

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
  SHA1:
3
- metadata.gz: 046b1e5327369856dee33f99a53977a2193dfc78
4
- data.tar.gz: 696c53ac82dc8c0580c365379055dcd02bfa64ae
3
+ metadata.gz: 5fbe595c3d525a08bfe506d7c116dde5c8928885
4
+ data.tar.gz: 27764ffe6c0c8096b5c7b17eace5c318c0a8037e
5
5
  SHA512:
6
- metadata.gz: bf99d6fd58f15a2f12caf85c37a9b621cace5146958c39c34a6df286285dcdbb302664970781f494d6a0761d638a7662cf9a40ccb6413813ccf48002e9238f41
7
- data.tar.gz: a8ba34aa544fb199f7f45335224d29e4c3bb90967f0f8240fd0069d0be820c6ae24bb075a5c71aa25a2ba95ab8978386f089b8538076a10435ab0bf5ebe33722
6
+ metadata.gz: 125f068d3618a1184254e2464719e8ac98b5bff432df29bdfebbc931fb5fb969317a93f2f3348d761e92ceef3f2d6735ef1234c69cfe780a91dd7e19fe02d3c1
7
+ data.tar.gz: 7d134e70413887e1f362e0727327f92ad8d2a713823512ee77d9be1af44c9fda8274a78b83268a053804f41a9ad4593ced7744d1204258e446a300ee43d05834
@@ -56,9 +56,10 @@ module Mongoid
56
56
  def with_tenant_criterion(criteria, base, document)
57
57
  item = base.tenant_field.to_sym
58
58
  name = document.database_field_name(item)
59
+ tenant_value = document.attributes[name]
59
60
 
60
61
  if document.class.tenant_options[:optional]
61
- if tenant_value = document.attributes[name]
62
+ if document.attributes[name]
62
63
  criteria = criteria.where(:"#{item}".in => [tenant_value, nil])
63
64
  end
64
65
  else
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  module Multitenancy
3
3
  # Version
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
6
6
  end
@@ -68,7 +68,7 @@ describe Mandatory do
68
68
  describe '#valid?' do
69
69
  context 'with a tenant' do
70
70
  before do
71
- item.client = client
71
+ Mongoid::Multitenancy.current_tenant = client
72
72
  end
73
73
 
74
74
  it 'is valid' do
@@ -97,10 +97,6 @@ describe Mandatory do
97
97
  end
98
98
 
99
99
  context 'without a tenant' do
100
- before do
101
- item.client = nil
102
- end
103
-
104
100
  it 'is not valid' do
105
101
  expect(item).not_to be_valid
106
102
  end
@@ -184,10 +184,6 @@ describe Optional do
184
184
  end
185
185
 
186
186
  context 'without a tenant' do
187
- before do
188
- item.client = nil
189
- end
190
-
191
187
  it 'is valid' do
192
188
  expect(item).to be_valid
193
189
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-multitenancy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aymeric Brisse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid