app/views/domains/create.js.erb
<% if @domain.persisted? %>
$('body').find('.domains tbody').append("<%= j render "domain", domain: @domain %>")
$('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()