我正在尝试用宝石做无限滚动 'will_paginate_infinite',但是我有“ nil:NilClass的未定义方法'next_page'的问题”,我只能使分页而不是无限滚动。
show.html.erb
<div class="container" >
<br>
<ul class="list-group" id="list-historic">
<%
@historics = PaperTrail::Version.where(event_id: @event.id).order(:created_at).paginate(:page => params[:page], :per_page => 15)
@historics.each do |version|
%>
<li class="list-group-item">
<%= version.created_at.strftime("%d de %B del %Y a las %I:%M:%S %p") %>
-
<strong><%= !Employee.find_by(user_id: version.whodunnit.to_i).nil? ? Employee.find_by(user_id: version.whodunnit.to_i).full_name : 'N/A' %></strong>
<% case version.event
when 'create' %>
creó <%= get_name_class(version.item_type) %> <%= get_message_by_class(version).html_safe %>
<% when 'update' %>
actualizo <%= get_name_class(version.item_type) %> <%= get_message_by_class(version).html_safe %> <%= get_message_update(version).html_safe %>
<% when 'destroy' %>
elimino <%= get_name_class(version.item_type) %>
<strong>'<%= get_message_delete_by_class(version).html_safe %>'</strong>
<% end %>
</li>
<% end %>
</ul>
<%= will_paginate @historics, renderer: WillPaginateInfinite::InfinitePagination %>
</div>
show.js.erb
<%= infinite_append "#list-historic", { partial: "exec/events/show_sections/historic_section", collection: @historics} %>
show.html.erb
<div id="historic_section" class="tab-pane fade">
<%= render 'exec/events/show_sections/historic_section'%>
</div>