title: Autosaving a form in Rails with AJAX
body: <p>I am trying to autosave a form for the Post#new action. Every minute or so, I want to POST to Post#autosave and then I'll check for first_or_create and save/updated the record in the Posts table. My problem though is, I can no longer access the POST params from the form. I am trying to do it like so:</p>
  
  <pre><code>$(function() {
    if ($("#new_post").length &gt; 0) {
      setTimeout(autoSavePost, 60000); 
    }    
  });
  
  function autoSavePost() {
    $.ajax({
      type: "POST",
      url: "/posts/autosave",
      dataType: "script",
      success: function(data) {
        console.log(data);
      }
    });
    setTimeout(autoSavePost, 60000);
  }
  </code></pre>
  
  <p>I have this route:</p>
  
  <pre><code>post 'posts/autosave', as: :autosave_post_path
  </code></pre>
  
  <p>The problem is, the server log shows the params hash as only containing :action and :controller. How can I access the equivalent of what would have been sent as part of the POST data.</p>