title: Rendering partial with AJAX link_to in Rails
body: <p>After completing Hartl's tutorial I'm trying to implement @replies for the Micropost model.</p>
  
  <p>I wanted the reply button on a micropost to render the micropost form right there under said post a la twitter. I also wanted to pass the :micropost_id of said post to the reply so that I could later reference which post it was a reply to, again a la twitter.</p>
  
  <p>I've been trying to implement some of that based on the answer to <a href="https://stackoverflow.com/questions/5099182/how-do-i-render-partial-via-ajax-in-rails3-and-jquery">this question</a>.</p>
  
  <p>My microposts controller has</p>
  
  <pre><code>def reply_form
  
      respond_to do |format|
        format.js
      end
    end
  </code></pre>
  
  <p>The link in the view is</p>
  
  <pre><code>&lt;%= link_to 'reply', 'shared/reply_form', remote: true, locals: { object: :id } %&gt;
  </code></pre>
  
  <p>With my attempt there to pass on the micropost :id</p>
  
  <p>After a post I have this for the partial to be rendered in:</p>
  
  <pre><code>&lt;div id="ReplyContainer"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I then have _reply_form.js.erb</p>
  
  <pre><code>$('#ReplyContainer').html('&lt;%=j render partial: 'shared/reply_form', locals: { object: :id } %&gt;')
  </code></pre>
  
  <p>It's not throwing errors but clicking the 'reply' link has no effect and does not render the _reply_form.html.erb partial.</p>
  
  <p>My ultimate goal is you click reply, that renders the micropost form, with @username at the start of the message (derived from the micropost_id?) submitting that form then saves the new micropost including the micro post_id of the original post in the reply_to column that I've created in my microposts table. Any nudges in the right direction much appreciated. Don't want to be barking up the completely wrong tree. Thanks. </p>
  
  <p><strong>EDIT:</strong> I'm currently getting a routing error when clicking the reply link.</p>
  
  <pre><code>(No route matches [GET] "/shared/reply_form")
  </code></pre>
  
  <p>But as far as I can see everything is in the right place.</p>