Ruby on Rails - Railscasts PRO #114 Endless Page (revised)

Railscasts Reloaded · 6K views · 2014 · 7:30

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the canonical walkthrough for infinite scroll with will_paginate, and cite it when debugging that code or porting the idea to other frameworks.

Recommended by 2 people across 2 different months, 2015 to 2019.

What it is

A 7.5-minute Railscasts Pro episode (revised edition) by Ryan Bates showing how to turn will_paginate pagination into infinite scrolling in a Rails app. It uses jQuery or CoffeeScript to fetch the next page when the user nears the bottom, with a js.erb response.

What people said

Recommends Andrey Drozdov · 2016-09 · Stack Overflow · on “Will_paginate, render next page”

Solve it, the problem appears because of my mistake. In here: jQuery -> url = $('.pagination .next_page a').attr('href') $(window).scroll -> url variable was assigned only one time, before scrolling and that was my mistake. So if url was save, so it always rendered second page and never third. We have to move our url lower, under .scroll event and it will always check, what page have been rendered. Like this: jQuery -> $(window).scroll -> url = $('.pagination .next_page a').attr('href') By the way, I will recommend to all (if they are using jQuery from RailsCast tutorial [this video] ) to add some script to prevent multiple page load when user scroll jQuery -> $(window).scroll -> url = $('.pagina

Recommends superbot · 2019-10 · Stack Overflow · on “Pagination, instead of infinite scroll, is showing. How to make this code work?”

@arieljuod I was following the tutorial, and that's how they had it... ( [this video] ). I tried it exactly as they had it, and it didn't work. I have no idea what to do.

Cites Szuturon · 2015-07 · Stack Overflow · on “How to have an action respond to javascript in PHP?”

I'm currently working with a Kohana project and am trying to implement endless scrolling. I'm trying to use the method Ryan Bates shows in the following Ruby on Rails video: [this video] At 3:21 he says the action won't respond to javascript and proceeds to create a js.erb file. What is the PHP equivalent to this step going forward? Where would I place the php file equivalent to his index.js.erb?

Cites Sean Magyar · 2016-01 · Stack Overflow · on “Will_paginate gem conflicts with Bootstrap built in panel”

You gotta change the params for will_paginate. At the moment you have page for both I guess. def get_files #loading files data with js on common_medias page @common_files = @conversation.messages.with_file.order(created_at: :desc).paginate(page: params[:files], per_page: 14) respond_to :js end def get_links #loading links data with js on common_medias page @message_links_pre = @conversation.messages.with_link.order(created_at: :desc).paginate(page: params[:links], per_page: 14) @message_links = @message_links_pre.map { |f| { link: f.link, created_at: f.created_at, user_id: f.user_id} }.flatten @common_links = formatting_links(@message_links) respond_to :js end and the html in the partials <%