Compare commits

..

2 Commits

Author SHA1 Message Date
e4dad698ea Merge branch 'wedding-model' of https://gitea.bustikiller.com/bustikiller/wedding-planner into wedding-model
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Successful in 33s
Add copyright notice / copyright_notice (pull_request) Successful in 47s
Run unit tests / unit_tests (pull_request) Failing after 1m14s
2024-11-30 21:11:43 +01:00
be3497ad64 Configure current tenant in a before_action of the ApplicationController 2024-11-30 21:11:25 +01:00

View File

@ -1,6 +1,7 @@
# Copyright (C) 2024 Manuel Bustillo # Copyright (C) 2024 Manuel Bustillo
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
before_action :set_tenant
before_action :authenticate_user! before_action :authenticate_user!
after_action :set_csrf_cookie after_action :set_csrf_cookie
@ -29,6 +30,10 @@ class ApplicationController < ActionController::Base
private private
def set_tenant
ActsAsTenant.current_tenant = Wedding.find_by(slug: params[:slug])
end
def development_swagger? def development_swagger?
Rails.env.test? || Rails.env.test? ||
Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html') Rails.env.development? && request.headers['referer']&.include?('/api-docs/index.html')