Module: MultiTenant::ControllerExtensions

Defined in:
lib/activerecord-multi-tenant/controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#set_current_tenant_through_filterObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/activerecord-multi-tenant/controller_extensions.rb', line 9

def set_current_tenant_through_filter
  class_eval do
    helper_method :current_tenant if respond_to?(:helper_method)

    private

    # rubocop:disable Naming/AccessorMethodName
    def set_current_tenant(current_tenant_object)
      MultiTenant.current_tenant = current_tenant_object
    end
    # rubocop:enable Naming/AccessorMethodName

    def current_tenant
      MultiTenant.current_tenant
    end
  end
end