Replace
<%= content_tag(:a, :href => contact_path(@contact), :class => "btn btn-warning pull-right", :style => "margin:0; margin-right:15px;", confirm: 'Are you sure?', method: :delete) do %>
with
<%= content_tag(:a, :href => contact_path(@contact), :class => "btn btn-warning pull-right", :style => "margin:0; margin-right:15px;", data: {confirm: 'Are you sure?'}, data: {method: :delete}) do %>
It should be data: {confirm: 'Are you sure?'}
instead of confirm: 'Are you sure?'
and also data: {method: :delete}
instead of method: :delete
.
where, link_to
method interpolates confirm: 'Are you sure?'
as data-confirm="Are you sure?"
and method: :delete
as data-method="delete"
.
BUT content_tag
method interpolates confirm: 'Are you sure?'
as confirm="Are you sure?"
and method: :delete
as method="delete"
so your javascript call is not getting invoked.