ruby-on-rails-4link-to

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

  • Confirm has been deprecated in rails 4.

    So use new syntax:

    <%= link_to "title", "#", data: {confirm: "Are you sure!"} %>