Take the 2-minute tour ×

I am trying to integrate jQuery.pageless plugin in my application, but in vain. Can anyone provide me with some resource that shows a Rails 3 demo application that has jQuery.pageless working?

I tried looking into the example application that is provided with the plugin, which is in Rails 2.2. I tried to implement everything in a similar manner, but I get the error undefined method 'total_pages' for Array <....>, which is the array of one of my models.

Here's the code snippets:

module ApplicationHelper
  def pageless(total_pages, url=nil, container=nil)
    opts = {
      :totalPages => total_pages,
      :url        => url,
      :loaderMsg  => 'Loading more results'

    container && opts[:container] ||= container



def index
  @posts = Post.all

  if request.xhr?
    sleep(3) # make request a little bit slower to see loader :-)
    render :partial => "shared/post", :collection => @posts


<div id="recent-sale-item-area">
  <% if !@posts.nil? %>
    <p id="recent-posts"> recent posts </p>
    <div id="recent-sale-item-list">
      <%= render :partial => "shared/post", :collection => @posts %>
    <%= will_paginate(@posts) %>
     <%= pageless(@posts.total_pages, posts_path) %>
  <% end %>
share|improve this question
Did you ever figure this out? –  wuliwong Jun 3 '13 at 0:56
add comment

1 Answer

The Github page for jQuery.pageless has what you want:



Your error is because Rails 3 no longer has pagination built-in. You will need to download the will_paginate or some other pagination gem, or roll your own.

share|improve this answer
Yes I did this first, that's where I downloaded the plugin from . I have changed the question a bit, please see. Thanks. –  rookieRailer Aug 22 '11 at 16:37
Edited my answer. –  Fareesh Vijayarangam Aug 22 '11 at 18:27
I have the will_paginate gem installed as well –  rookieRailer Aug 22 '11 at 18:51
You will need to post your code then. –  Fareesh Vijayarangam Aug 22 '11 at 18:52
I added my codes. –  rookieRailer Aug 22 '11 at 19:12
show 1 more comment

Your Answer


