<% @group_order_invoices.each do |group_order_invoice| %> $("#payed_<%= group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_payed', locals: { group_order_invoice: group_order_invoice }) %>"); <% end %> $("#toggle_all_payed_<%= @order.id %>").html("<%= escape_javascript(render partial: 'toggle_all_payed', locals: { order: @order }) %>");