Merge pull request 'fix-tenant-scope' (#159) from fix-tenant-scope into main
Some checks failed
Check usage of free licenses / check-licenses (push) Successful in 1m2s
Run unit tests / unit_tests (push) Successful in 2m57s
Build Nginx-based docker image / build-static-assets (push) Failing after 15m23s

Reviewed-on: #159
This commit is contained in:
bustikiller 2024-12-02 19:35:36 +00:00
commit e0a34df7b7
3 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# Copyright (C) 2024 Manuel Bustillo
class ApplicationController < ActionController::Base
set_current_tenant_through_filter
before_action :set_tenant
before_action :authenticate_user!
after_action :set_csrf_cookie
@ -47,7 +48,7 @@ class ApplicationController < ActionController::Base
end
def set_tenant
ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug])
set_current_tenant(Wedding.find_by!(slug: params[:slug]))
end
def development_swagger?

View File

@ -0,0 +1,5 @@
# Copyright (C) 2024 Manuel Bustillo
ActsAsTenant.configure do |config|
config.require_tenant = !Rails.env.test?
end

View File

@ -2,12 +2,15 @@
NUMBER_OF_GUESTS = 50
TablesArrangement.delete_all
Expense.delete_all
Guest.delete_all
Group.delete_all
ActsAsTenant.without_tenant do
TablesArrangement.delete_all
Expense.delete_all
Guest.delete_all
Group.delete_all
Wedding.delete_all
end
Wedding.delete_all
wedding = Wedding.create!(slug: :default, date: 1.year.from_now)
ActsAsTenant.with_tenant(wedding) do