Merge pull request 'fix-tenant-scope' (#159) from fix-tenant-scope into main
Reviewed-on: #159
This commit is contained in:
commit
e0a34df7b7
@ -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?
|
||||
|
5
config/initializers/acts_as_tenant.rb
Normal file
5
config/initializers/acts_as_tenant.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# Copyright (C) 2024 Manuel Bustillo
|
||||
|
||||
ActsAsTenant.configure do |config|
|
||||
config.require_tenant = !Rails.env.test?
|
||||
end
|
13
db/seeds.rb
13
db/seeds.rb
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user