title: Using history.pushState with rails ajax request
body: <p>I'm working on a messaging section in an app and am having some problems with history.pushState. Basically, I have 2 views, one that lists all threads, and one to show a single thread. When a user clicks on a thread (with a link set to remote=true), rails responds with my show.js.erb file. This file includes</p>
  
  <pre><code>    $("#layout-body").html("&lt;%=j render :partial =&gt; 'thread' %&gt;");
      if (Modernizr.history) { history.pushState("test: testy", null, "&lt;%=j raw message_thread_url(params) %&gt;"); }
  </code></pre>
  
  <p>Currently, when the thread is clicked, the url correctly updates to /messages/ID. However when I hit the back button, the url changes back to /messages, but the page content doesn't change. How do I go about making this work? Am I going about it the right way?</p>