Rails 4 - link_to with confirmation in Rails

I am trying to customize my dialog by validating link_to in rails 4. But I dont understand why it is sending html as "validate" and needs to be "validated by data"!

I've tried several ways and it always generates "confirm" like:

<%= 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 this example in the tutorial but also doesn't work

+3


source to share


1 answer


Confirmation is deprecated in rails 4.

So, use the new syntax:



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

      

+9


source







All Articles