ruby on rails - link_to update attribute does not give the confirmation box that i want -


i have link updates 1 attribute in database when click. want confirmation box when click this:

<%= link_to "close task", task_path(@task, task: {is_task_closed: true}), :method => :put, :confirm => "are sure?" , class: "btn btn-danger btn-md" %> 

but not give confirmation box. updates task table. want user have prompt when clicks make confirmation. tried other syntax cant make work. can tell me wrong , why doe not give confirmation dialog box. have other link, ie delete link promts dialog box when click them. update link why not work?

help please thanks.

as per uri helpers, data:{:confirm => 'are sure?'} should used. can see reference http://apidock.com/rails/actionview/helpers/urlhelper/link_to

link_to "visit other site", "http://www.rubyonrails.org/", data: { confirm: "are sure?" } # => <a href="http://www.rubyonrails.org/" data-confirm="are sure?">visit other site</a>