mardi 5 mai 2015

inserting a partial with infinite scroll

I have implemented the tutorial for infinite scroll as shown here http://ift.tt/1gFoqre

I however would like to render the partial for _formatted_posts.html.erb as opposed to just the generic _posts partial. If I change index.html.erb to

<div class="page-header">
  <h1>My posts</h1>
</div>

<div id="my-posts">
<% @posts.in_groups_of(3, false) do |posts| %>
    <div class="row padding-top-30">
      <% posts.each do |post| %>
          <div class="col-md-4">
            <%= render '_formatted_post', :post => post %>
          </div>
      <% end %>
    </div>    

<div id="infinite-scrolling">
  <%= will_paginate %>
</div>

It renders the first page of paginated posts fine, however as soon as it renders the second page of paginated posts it goes back to displaying it using the _posts.html.erb partial as opposed to _formatted_posts.html.erb

Does anyone have any advice on how to solve this problem?

All the best, Durham

Aucun commentaire:

Enregistrer un commentaire