$("div.tab-easy-entity-activity-content tbody tr.form").remove();
$("div.tab-easy-entity-activity-content tbody tr").toggle(true);
<%= fields_for @easy_entity_activity, remote: true do |f| %>
var prev = $(".<%= dom_id(@easy_entity_activity)%>").first().prev();
if(prev.size() == 0) {
  prev = $(".<%= dom_id(@easy_entity_activity)%>").parent();
  $(".<%= dom_id(@easy_entity_activity)%> tr").hide();
  $(".<%= dom_id(@easy_entity_activity)%>").append("<%= j render(:partial => '/easy_entity_activities/form', locals: {f: f}) %>");
} else {
  $(".<%= dom_id(@easy_entity_activity)%> tr").hide();
  $(".<%= dom_id(@easy_entity_activity)%>").append("<%= j render(:partial => '/easy_entity_activities/form', locals: {f: f}) %>");
}
<% end %>

$('.tab-easy-entity-activity-content form').attr('action', "<%= easy_entity_activity_path(@easy_entity_activity) %>");
$('.tab-easy-entity-activity-content form').attr('method', 'patch');
