rails comments in a post ajax load more
<p>I have a standard <code>will_paginate</code>, but I want a button to load more comments, like Instagram. I searched many solutions, but I couldn't apply it to my project.</p>

<p>posts/index.html.erb</p>

<pre class="lang-erb prettyprint-override"><code>&lt;%  @posts.each do |post| %&gt;
&lt;p&gt;&lt;%= pluralize(post.comments.count, "Comment") %&gt;&lt;/p&gt;
 &lt;div id="comid_&lt;%= post.id %&gt;"&gt;&lt;/div&gt;
 &lt;div id='comments'&gt;
   &lt;% @comments = post.comments.paginate(:per_page =&gt; 10, :page =&gt; params[:page]).order("created_at DESC") %&gt;
   &lt;%= render @comments %&gt;
  &lt;%= will_paginate @comments, :class =&gt;"pagination" %&gt;
 &lt;/div&gt;
</code></pre>



<p>Github <a href="http://www.example.com/" rel="nofollow">my instagram_clone</a></p>

<p>Heroku <a href="http://www.example.com/" rel="nofollow">my instagram_clone</a></p>