I'm working on a rails 7 app with hotwire. I have a form modal, when subimited, turbo should remove html from modal and show flash message.
When i put my turbo code in my controller i works:
# emails_controller.rb
def forward
service = Email::Forward.new(
recipients: params[:recipients].split(','),
sender: current_user.email,
html: params[:html_to_forward]
).call
if service.errors.empty?
flash.now[:success] = t('.success')
else
flash.now[:error] = t('.error')
end
respond_to do |format|
format.turbo_stream do
render turbo_stream: [
turbo_stream.update('forward_modal', ''),
turbo_stream.update('flash', partial: 'shared/flash', locals: { flash: flash })
]
end
end
But when i try to put the same code in a forward.turbo_stream.slim view, it do nothing, and i have no error message.
# views/emails/forward.turbo_stream.rb
= turbo_stream.update('forward_modal', '')
= turbo_stream.update('flash', partial: 'shared/flash', locals: { flash: flash })
Any idea about what is happening ?