Files
fizzy/config/initializers/tenanting/turbo.rb
T
Mike Dalessio e378c5a45e Extract pieces from the tenanting initializer
into:

- tenanting/account_slug
- tenanting/logging
- tenanting/turbo
2025-07-01 15:56:14 -04:00

19 lines
502 B
Ruby

module TurboStreamsJobExtensions
extend ActiveSupport::Concern
class_methods do
def render_format(format, **rendering)
if ApplicationRecord.current_tenant
script_name = "/#{ApplicationRecord.current_tenant}"
ApplicationController.renderer.new(script_name: script_name).render(formats: [ format ], **rendering)
else
super
end
end
end
end
Rails.application.config.after_initialize do
Turbo::StreamsChannel.prepend TurboStreamsJobExtensions
end