François Gagneau
Joined 3/29/2023
François Gagneau said over 1 year ago on Hotwire Modals :
Hi! I have a problem handling errors. In my case I need to be able to create a company from the menu of my application, so from anywhere in the application.
I managed to display the modal with your method, but I don't know what should I do when there are errors, I tried this :

if @company.save
  redirect_to company_root_path(company_slug: @company.slug), notice: t('.success')
else
  turbo_stream.update('modal', partial: 'form_modal', locals: {company: @company})
end

but nothing change and I can't submit again, and when I try render 'new', I do have the form with errors in my modal, but it also redirect to the new page, I just need to update the modal without being redirect. I'm a noob with turbo!

Did anyone have a solution? Thanks in advance.

François Gagneau said over 1 year ago on Hotwire Modals :
Ok sorry for this, it's a legacy project and i just found that someone have set data-turbo to false... It works like a charm now