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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fbe595c3d525a08bfe506d7c116dde5c8928885
|
4
|
+
data.tar.gz: 27764ffe6c0c8096b5c7b17eace5c318c0a8037e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
62
|
+
if document.attributes[name]
|
62
63
|
criteria = criteria.where(:"#{item}".in => [tenant_value, nil])
|
63
64
|
end
|
64
65
|
else
|
data/spec/mandatory_spec.rb
CHANGED
@@ -68,7 +68,7 @@ describe Mandatory do
|
|
68
68
|
describe '#valid?' do
|
69
69
|
context 'with a tenant' do
|
70
70
|
before do
|
71
|
-
|
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
|
data/spec/optional_spec.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|