Definitely easier...

<% if @user.errors.any? %>
  $(".error_messages").replaceWith("<%= escape_javascript(render('error_message', resource: @user)) %>")
<% else %>
  $("#signup_form").replaceWith("<%= escape_javascript(render('show')) %>");
  window.print();
<% end %>