app/views/env_vars/create.js.erb
<% if @env_var.persisted? %>
$('body').find('.env-vars tbody').append("<%= j render "env_var", env_var: @env_var %>")
$('body').find("[data-role~=form] form").trigger("reset")
$('body').find("[data-role~=empty-table]").addClass("is-hidden")
<% else %>
$('body').find("[data-role~=form]").html("<%= j render "form" %>");
<% end %>
new FormErrorHandler().reset()
new FormErrorHandler().execute()