tr.nested-fields
- if f.object.try(:persisted?)
td
p.form-control-static = f.object.try(:operacao_de_credito).try(:codigo)
- else
td
= f.select :operacao_de_credito_id,
options_from_collection_for_select(@operacoes_de_credito, :id, :codigo, f.object.try(:operacao_de_credito_id)),
{ include_blank: "Selecione" },
class: "form-control s2 col-sm-8",
id: "operacao_de_credito_id"
= error_for f.object, :operacao_de_credito_id
td
= link_to_remove_association " Remover", f, class: "btn btn-sm btn-danger icone-anular"
javascript:
$(function(){
$('form').on('cocoon:after-insert', function(e, insertedItem) {
$('select.s2', insertedItem).select2();
$('select.s2').on('select2:select', function (evt) {
$(this).focus();
});
});
});