title: How should a form error page be rendered with Turbolinks 5
body: <p>Using the new Turbolinks 5 in a rails application - what is the best way to render a form with error messages. The documentation says:</p>
  
  <blockquote>
    <p>Instead of submitting forms normally, submit them with XHR. In response to an XHR submit on the server, return JavaScript that performs a Turbolinks.visit to be evaluated by the browser.</p>
  </blockquote>
  
  <p>So if my form submits a remote request to update should i be just doing a js form replace or does turbolinks 5 have a better way? Example -</p>
  
  <p>controller:</p>
  
  <pre><code>def update
    @success = @team.update_attributes( team_params )
  end
  </code></pre>
  
  <p>update.js</p>
  
  <pre><code>&lt;% if @success %&gt;
     Turbolinks.visit('&lt;%= teams_path %&gt;', {action: 'replace'});
  &lt;% else %&gt;
     $('form').replaceWith('&lt;%= j(render partial: '/teams/form') %&gt;');
  &lt;% end %&gt;
  </code></pre>
  
  <p>Is there a more turbolinks 5 way to handle the failed update?</p>