0
<%= link_to "Destroy", article_url(article), data: {  turbo_method: :delete,  turbo_confirm: "Are you sure?"} %>

its generated wrong link but after rebooted PC it generate proper link:

<a data-turbo-method="delete" data-turbo-confirm="Are you sure?" href="http://localhost:3000/articles/6">Destroy</a>

but rails somehow still redirect to show, not to delete controller I tried replace it by

<%= button_to 'delete', article_url(article), method: :delete,
                form: {data: {turbo_confirm: "are you sure?"}} %>

its work, except confirmation does not appear. I think problem with turbo, when i generate project i used: rails new lenglish -c bootstrap i just start write project and there are only CRUD for article, and header, footer, github: https://github.com/kukla1989/lenglish. Will be very appreciative for any help and pardon for my poor choice of words.

roman
  • 11
  • 3
  • That's very strange I copied your link_to helper and on my side I get `data-turbo-method="delete"` not `data-method="delete"` . Not too sure where it is coming from. Do you have `gem "turbo-rails"` in your gemfile ? – Maxence Sep 18 '22 at 17:56
  • Turbo-rails installed by default, so yea. I am sure that link_to written properly problem probably with turbo – roman Sep 19 '22 at 05:24

1 Answers1

0

as i mentioned in question problem was in turbo, after i ran server with command bin/dev everything becomes work fine edit: rails during creating app somehow didn't put <%= javascript_importmap_tags %> in application.html.erb, that was problem

roman
  • 11
  • 3