Bringing back the TurboStreamsExtension

so that, for example, notification content contains the URLs properly
scoped to the account.
This commit is contained in:
Mike Dalessio
2025-11-14 16:24:31 -05:00
parent 3ed36004e4
commit 2a1817d902
+15 -17
View File
@@ -1,19 +1,17 @@
# # TODO:PLANB: we probably still need to set script_name properly
# module TurboStreamsJobExtensions
# extend ActiveSupport::Concern
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
class_methods do
def render_format(format, **rendering)
if Current.account.present?
ApplicationController.renderer.new(script_name: Current.account.slug).render(formats: [ format ], **rendering)
else
super
end
end
end
end
# Rails.application.config.after_initialize do
# Turbo::StreamsChannel.prepend TurboStreamsJobExtensions
# end
Rails.application.config.after_initialize do
Turbo::StreamsChannel.prepend TurboStreamsJobExtensions
end