Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Transparent support for pagination using WillPaginate and ActiveResource over POX (Plain Old Xml)
branch: master
Failed to load latest commit information.
lib fixing problem with version file
spec moving to will paginate 3.0.0
.gitignore Updating gemfile to use non-beta versions and ignore rbc files
CHANGELOG updating the change log
Gemfile cleaning up gemspec and Gemfile, removing Jeweler
LICENCE cleaning up gemspec and Gemfile, removing Jeweler
README.rdoc fixing problem with version file
Rakefile cleaning up gemspec and Gemfile, removing Jeweler
pox_paginate.gemspec fixing problem with version file


PoxPaginate 0.2.5

PoxPaginate is an extension to WillPaginate and ActiveResource that makes it possible to transparently paginate over a collection of XML serialised resources.

This gem is based on our experience building largish distributed systems consisting of multiple Rails apps integrated over POX (Plain Old XML). Yes, it is in production. No, unfortunately we aren't allowed to talk about it.


PoxPaginate is available as a gem. In your Gemfile add

gem 'pox_paginate', '~> 0.2.0' # Please check for the latest version

We also strongly recommend you use Ruby LibXML or Nokogiri rather than the standard REXML for deserialisation. While PoxPaginate supports all three, REXML is simply too slow for use in production. To switch to using either gem:

gem 'nokogiri', '~>'


gem 'libxml-ruby', '~> 1.1.4'
  • These gems are not added in the Gemfile

After this, you need to instruct Rails to use them. In application.rb, do

ActiveSupport::XmlMini.backend = 'LibXML'


ActiveSupport::XmlMini.backend = 'Nokogiri'

JDOM is supported as a backend on JRuby

ActiveSupport::XmlMini.backend = 'JDOM'


When constructing the xml serialised form of a resource in a controller, add pagination - like so:

class ProductsController < ApplicationController

  # GET /products
  # GET /products.xml
  def index
    @products = Product.paginate :page => params[:page], :per_page => params[:per_page]
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @products }

PoxPaginate extends WillPaginate::Collection to add 'current_page,' 'per_page' and 'total_entries' as attributes on the root node of the collection xml.

On the client, you do the usual:

class Product < ActiveResource::Base = ''

Now whenever you do

Product.find(:all, :params => {:page => 2, :per_page => 5})

PoxPaginate will kick in if pagination related attributes are present on the root node, and will result in the creation of a PoxPaginate::RemoteCollection, which is a subclass of WillPaginate::Collection and so behaves in exactly the same manner.


  • PoxPaginate currently overrides the Hash.from_xml method to fix a bug in Rails that is documented in this Rails issue

  • This patch is merged in Rail head (not in RC6)

  • PoxPaginate must needs be installed on both the client and the server Rails instance

Continuous Itegration

You can find the link to the pox_paginate CI build over at the C42 Engineering open source page.

How to contribute

  • Create an issue describing what you're adding (or fixing)

  • Fork pox_paginate

  • Make your changes, including specs, with the issue number in the commit message

  • Run the build (running rake should do it) to make sure everything is all right

  • Send us a pull request

If your patch is accepted, we will add you to the 'Contributors' section of the README.


Something went wrong with that request. Please try again.