Rene Jespersen Rene Jespersen - 2 months ago 16
Ruby Question

Confirm popup not working

I have a problem as the confirm popup is not showing, when i use my delete button. The deleting works fine, i just dont get the "are you sure" popup first.

I have tried different variantions of this code, without any luck. I think i have the confirm part correct, but perhaps not. What am i missing here?

<%= link_to t('common.delete'), car_path(@current_work_context, car), :method => :delete, :confirm => t('common.are_you_sure'), :class => "btn btn-danger btn-xs" if car.deletable? %>

Answer

Try to change :confirm => t('common.are_you_sure') to data: { confirm: 'Are you sure?' }, or an old version: :data => { :confirm => 'Are you sure?' }

And what about your application.js? Does it includes jquery like this:

//= require jquery
//= require jquery_ujs

?

Comments