Files
sx-fc/app/controllers/application_controller.rb
Thein Lin Kyaw 937f40e7c1 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
2019-12-02 17:19:28 +06:30

22 lines
726 B
Ruby
Executable File

class ApplicationController < ActionController::Base
include LoginVerification, MultiTenancy
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail, :order_reservation, :bank_integration
# lookup domain for db from provision
# before_action :set_locale
# helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
#this is base api base controller to need to inherit.
#all token authentication must be done here
#response format must be set to JSON
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to root_path
end
end