I followed the tutorial here http://railsforbeginners.com/chapters/chapter-9-infinite-scroll/ for an infinite scrolling. The code works good locally but when I deploy it to prod. the pagination links (1 2 3 4) still show and the infinite scrolling doesn't fire. I also tried to add these files in assets.rb
with no success
First of I'm using Rails 4
, my application.js
looks like this
//= require jquery2
//= require jquery.turbolinks
//= require jquery_ujs
//= require jquery-ui.min
//= require bootstrap-hover-dropdown.min
//= require bootstrap.min
//= require select2
//= require infinite_scroll
//= require turbolinks
Controller action
respond_to do |format|
format.html
format.js { render "visitors/index" }
end
index.js.erb
$('#my-articles').append('<%= j render @articles %>');
<% if @articles.next_page %>
$('.pagination').replaceWith('<%= j will_paginate @articles %>');
add_tweets();
<% else %>
$(window).off('scroll');
$('.pagination').remove();
<% end %>
function add_tweets(){
<% @articles.each do |article|%>
handle_open_modal("<%= article.id %>");
<%end%>
}