From the question you have posed, and the information you have provided,
there is not a simple ‘do this’ answer. You need to get a bit further
the path of what you want to achieve. (unless someone knows some magic
that I am unaware of).
Looking at what you have so far, it would seem that you have the basic
functionality of the page, and you have an idea of what you want to
achieve, but you do not yet appear to have a strategy or plan for how
are going to achieve it. I have never implemented continuous scroll,
giving it some cursory thought, I would begin by asking myself some
How is the page update going to take place when I extend the
eg. - replace the whole page each time the list updates
or - replace the list section
or - add additional items at the end
Do I let the page size continue to grow indefinitely or do I remove
some items from the other end.
If I am going to manage addition/deletion of items. The items will
probably be best structured in an an html list or table, and each may
a unique id, or can I just append/prepend to the list of items.
What mechanism will I use to identify the next ‘page’ of items I want
add to the list.
How is my controller going to get the correct list of items to add?
what paging mechanism am I using.
How am I going to handle the ajax response that contains the items.
am going to need some js code to append/prepend or insert the items into
erb template to insert the items, or I could have a js function on the
browser side ready to handle the response (eg as a success callback
handler.) Or I could return data as json and handle the paging more
in the browser js.
Finally having thought about all this, I would do some googling to
if someone has already implemented such a thing in a form I could learn
from, or is there maybe a js library that might already provide most of
functionality I require.
I am sorry this is not a direct answer, but hopefully it may help to
clarify what you are trying to achieve and how you are going to go about