Make the application multi-tenant based on a wedding model #153

Merged
bustikiller merged 16 commits from wedding-model into main 2024-12-01 10:11:25 +00:00
Showing only changes of commit be3497ad64 - Show all commits

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')