Single database for multiple shops

Use ActsAsTenant as Multi-tenancy for shops

See below files:
- app/controllers/concern/multi_tenancy.rb
- app/models/application_record.rb
- app/models/shop.rb

An initializer can be created to control option in ActsAsTenant.
config/initializers/acts_as_tenant.rb
require 'acts_as_tenant/sidekiq'
ActsAsTenant.configure do |config|
  config.require_tenant = false # true
end

more details: https://github.com/ErwinM/acts_as_tenant
This commit is contained in:
Thein Lin Kyaw
2019-12-02 17:19:28 +06:30
parent 5d10d4b6a1
commit 937f40e7c1
78 changed files with 215 additions and 173 deletions

View File

@@ -46,6 +46,9 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts_as_tenant (0.4.4)
rails (>= 4.0)
request_store (>= 1.0.5)
aescrypt (1.0.0)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
@@ -219,6 +222,8 @@ GEM
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (3.3.5)
request_store (1.4.1)
rack (>= 1.4)
roo (1.13.2)
nokogiri
rubyzip
@@ -315,6 +320,7 @@ PLATFORMS
ruby
DEPENDENCIES
acts_as_tenant
aescrypt
axlsx (= 2.0.1)
axlsx_rails
@@ -374,10 +380,8 @@ DEPENDENCIES
web-console (>= 3.3.0)
whenever
RUBY VERSION
ruby 2.4.1p111
BUNDLED WITH
2.0.2