Limit visibility per tenant
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 57s
Check usage of free licenses / check-licenses (pull_request) Successful in 1m29s
Run unit tests / unit_tests (pull_request) Failing after 3m28s

This commit is contained in:
Manuel Bustillo 2024-12-02 09:04:48 +01:00
parent ef573c5f73
commit 3fca449461
2 changed files with 4 additions and 2 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

@ -9,9 +9,10 @@ ActsAsTenant.without_tenant do
Group.delete_all
Wedding.delete_all
wedding = Wedding.create!(slug: :default, date: 1.year.from_now)
end
wedding = Wedding.create!(slug: :default, date: 1.year.from_now)
ActsAsTenant.with_tenant(wedding) do
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')