'Rails 4 - link_to with confirm in Rails

I'm trying to customize my dialog confirm the link_to in rails 4. But I do not understand why he rides the html as "confirm", and should be "data-confirm"!

I've tried a number of ways, and it is always generated "confirm", like this:

<%= link_to 'Delete', user, :method => :delete, :confirm => 'Are you sure?' %>

<a confirm="Are you sure?" rel="nofollow" data-method="delete" href="/user/13">Delete</a>

I followed this tutorial: http://thelazylog.com/custom-dialog-for-data-confirm-in-rails/ and i used the example in tutorial, but also doesn't work



Solution 1:[1]

To get the same behavior in rails 7 you should use turbo_confirm key instead:

<%= link_to 'Delete', user,
  data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1