Хотя документация button_to
прямолинейна, я получаю метод post
вместо delete
Вот моя реализация:
= button_to experiment_path(experiment), params: {tr_number: tr_counter}, remote: true, form: { "data-type" => "script"}, data: { confirm: "Are you sure?" }, :style=>"padding: 3px;", :class=>'btn btn-danger', :method => :delete do
%i{class: 'fa fa-trash'}
результат:
<form data-type="script" class="button_to" method="post" action="/en/experiments/10170-dc-voltage-inverter-using-capacitor" data-remote="true">
<input type="hidden" name="_method" value="delete">
<button data-confirm="Are you sure?" style="padding: 3px;" class="btn btn-danger" type="submit">
<i class="fa fa-trash"></i>
</button>
<input type="hidden" name="authenticity_token" value="xxxxx">
<input type="hidden" name="tr_number" value="0">
</form>
Есть идеи?