motel-activerecord 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/motel/railtie.rb +6 -4
- data/spec/tmp/tenants.sqlite3 +0 -0
- metadata +38 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1275f8eb347d61ff0aefb090f550154cfc2a3dc2
|
|
4
|
+
data.tar.gz: 928c7506b87ec1057b9fbda06392729d1cbaab32
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcb3abb6c7785374b284b03d96f33d0c13238fa1f8945c6134a1880291f3155735d42082e3de7e73c04f4b0aa9be5c460d6db8591336ab65e22d4b90a8bad629
|
|
7
|
+
data.tar.gz: b1036fd084f60a19341df61f52fe6a2b86bb4adbb29c608a9c5fcae87a46b396d5fa79ef49723164d56f54fe1804ee005352808f8585336ab0083948e6a2cfb5
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.
|
|
1
|
+
2.0.3
|
data/lib/motel/railtie.rb
CHANGED
|
@@ -16,8 +16,9 @@ module Motel
|
|
|
16
16
|
Rails.application.config.motel.tenants_source_configurations
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
-
# Set a current tenant allow to db:create:all task
|
|
20
|
-
|
|
19
|
+
# Set a current tenant allow to db:create:all task establish and
|
|
20
|
+
# retrieve the connection
|
|
21
|
+
Motel::Manager.current_tenant ||= self.class
|
|
21
22
|
|
|
22
23
|
ActiveRecord::Tasks::DatabaseTasks.database_configuration = Motel::Manager.tenants
|
|
23
24
|
ActiveRecord::Base.configurations = ActiveRecord::Tasks::DatabaseTasks.database_configuration
|
|
@@ -51,8 +52,9 @@ module Motel
|
|
|
51
52
|
|
|
52
53
|
ActiveSupport.on_load(:active_record) do
|
|
53
54
|
ActionDispatch::Reloader.send(hook) do
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
ActiveRecord::Base.clear_reloadable_connections!
|
|
56
|
+
# Clear cache of the current tenant with an active connection
|
|
57
|
+
if Motel::Manager.active_tenants.include?(Motel::Manager.determines_tenant)
|
|
56
58
|
ActiveRecord::Base.clear_cache!
|
|
57
59
|
end
|
|
58
60
|
end
|
data/spec/tmp/tenants.sqlite3
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: motel-activerecord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Diego Martínez Valdelamar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-09-
|
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '4.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ~>
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '4.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: activesupport
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ~>
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '4.0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ~>
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '4.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: redis
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: 3.0.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- -
|
|
52
|
+
- - ~>
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 3.0.0
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '3.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- -
|
|
66
|
+
- - ~>
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '3.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: sqlite3
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- -
|
|
73
|
+
- - ~>
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '1.0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- -
|
|
80
|
+
- - ~>
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '1.0'
|
|
83
83
|
description: ActiveRecord extension to use connections to multiple databases
|
|
@@ -86,34 +86,34 @@ executables: []
|
|
|
86
86
|
extensions: []
|
|
87
87
|
extra_rdoc_files: []
|
|
88
88
|
files:
|
|
89
|
-
- README.md
|
|
90
|
-
- VERSION
|
|
91
89
|
- lib/motel-activerecord.rb
|
|
92
|
-
- lib/motel/connection_adapters.rb
|
|
93
|
-
- lib/motel/connection_adapters/connection_handler.rb
|
|
94
|
-
- lib/motel/connection_adapters/connection_specification.rb
|
|
95
|
-
- lib/motel/connection_adapters/connection_specification/resolver.rb
|
|
96
|
-
- lib/motel/errors.rb
|
|
97
|
-
- lib/motel/lobby.rb
|
|
98
90
|
- lib/motel/manager.rb
|
|
99
|
-
- lib/motel/multi_tenant.rb
|
|
100
|
-
- lib/motel/railtie.rb
|
|
101
91
|
- lib/motel/sources.rb
|
|
92
|
+
- lib/motel/railtie.rb
|
|
102
93
|
- lib/motel/sources/database.rb
|
|
103
94
|
- lib/motel/sources/default.rb
|
|
104
95
|
- lib/motel/sources/redis.rb
|
|
96
|
+
- lib/motel/errors.rb
|
|
105
97
|
- lib/motel/version.rb
|
|
106
|
-
-
|
|
98
|
+
- lib/motel/connection_adapters.rb
|
|
99
|
+
- lib/motel/multi_tenant.rb
|
|
100
|
+
- lib/motel/connection_adapters/connection_specification/resolver.rb
|
|
101
|
+
- lib/motel/connection_adapters/connection_specification.rb
|
|
102
|
+
- lib/motel/connection_adapters/connection_handler.rb
|
|
103
|
+
- lib/motel/lobby.rb
|
|
104
|
+
- VERSION
|
|
105
|
+
- README.md
|
|
106
|
+
- spec/tmp/foo.sqlite3
|
|
107
|
+
- spec/tmp/tenants.sqlite3
|
|
108
|
+
- spec/spec_helper.rb
|
|
109
|
+
- spec/lib/motel/sources/default_spec.rb
|
|
110
|
+
- spec/lib/motel/sources/database_spec.rb
|
|
111
|
+
- spec/lib/motel/sources/redis_spec.rb
|
|
107
112
|
- spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
|
|
113
|
+
- spec/lib/motel/connection_adapters/connection_handler_spec.rb
|
|
114
|
+
- spec/lib/motel/multi_tenant_spec.rb
|
|
108
115
|
- spec/lib/motel/lobby_spec.rb
|
|
109
116
|
- spec/lib/motel/manager_spec.rb
|
|
110
|
-
- spec/lib/motel/multi_tenant_spec.rb
|
|
111
|
-
- spec/lib/motel/sources/database_spec.rb
|
|
112
|
-
- spec/lib/motel/sources/default_spec.rb
|
|
113
|
-
- spec/lib/motel/sources/redis_spec.rb
|
|
114
|
-
- spec/spec_helper.rb
|
|
115
|
-
- spec/tmp/foo.sqlite3
|
|
116
|
-
- spec/tmp/tenants.sqlite3
|
|
117
117
|
homepage: https://github.com/dimarval/motel-activerecord
|
|
118
118
|
licenses:
|
|
119
119
|
- MIT
|
|
@@ -124,17 +124,17 @@ require_paths:
|
|
|
124
124
|
- lib
|
|
125
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
|
-
- -
|
|
127
|
+
- - ~>
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
129
|
version: '2.0'
|
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
requirements:
|
|
132
|
-
- -
|
|
132
|
+
- - '>='
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
136
|
rubyforge_project:
|
|
137
|
-
rubygems_version: 2.
|
|
137
|
+
rubygems_version: 2.0.3
|
|
138
138
|
signing_key:
|
|
139
139
|
specification_version: 4
|
|
140
140
|
summary: Multi-tenant gem
|
|
@@ -142,11 +142,12 @@ test_files:
|
|
|
142
142
|
- spec/tmp/foo.sqlite3
|
|
143
143
|
- spec/tmp/tenants.sqlite3
|
|
144
144
|
- spec/spec_helper.rb
|
|
145
|
-
- spec/lib/motel/manager_spec.rb
|
|
146
|
-
- spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
|
|
147
|
-
- spec/lib/motel/connection_adapters/connection_handler_spec.rb
|
|
148
145
|
- spec/lib/motel/sources/default_spec.rb
|
|
149
146
|
- spec/lib/motel/sources/database_spec.rb
|
|
150
147
|
- spec/lib/motel/sources/redis_spec.rb
|
|
151
|
-
- spec/lib/motel/
|
|
148
|
+
- spec/lib/motel/connection_adapters/connection_specification/resolver_spec.rb
|
|
149
|
+
- spec/lib/motel/connection_adapters/connection_handler_spec.rb
|
|
152
150
|
- spec/lib/motel/multi_tenant_spec.rb
|
|
151
|
+
- spec/lib/motel/lobby_spec.rb
|
|
152
|
+
- spec/lib/motel/manager_spec.rb
|
|
153
|
+
has_rdoc:
|