public
Description: Simple pagination for ActiveResource
Homepage:
Clone URL: git://github.com/phorsfall/resourceful_pagination.git
README.txt
resourceful_pagination
    by Paul Horsfall
    http://deaddeadgood.com/

== DESCRIPTION:

Standing on will_paginate's shoulders, resourceful_pagination extends 
ActiveResource to provide simple pagination.

== FEATURES/PROBLEMS:

== SYNOPSIS:

Before you can use resourceful_pagination you need to add 2 class methods 
to your ActiveResources.

1. A count method which returns the total number of items. This could call a 
   custom count action on the app server.
2. A per_page method indicating how many records you require per page.

You also need the index action of the controller on the app server to handle 
the :starting_at and :per_page parameters. These map to :offset and :limit in 
SQL and can be passed straight through to ActiveRecord or other ORM.

With all that in place, in your web app you can do:

  MyResource.paginate(:page => params[:page])

This returns a WillPaginate::Collection which works with will_paginate's view 
helpers as normal.

Extra parameters can be specified as you would with ActiveResource::Base#find:

  MyResource.paginate(:page => params[:page], :params => { :title => 'CEO' })

As these parameters may also affect the size of the collection returned, they 
will also be handed to the count method. You'll need to handle this and return 
the proper count.

== REQUIREMENTS:

* will_paginate
* active_resource

== INSTALL:

Install the gem:

  sudo gem install phorsfall-resourceful_pagination --source http://gems.github.com

Then add the following to 'config/environment.rb':

  require 'resourceful_pagination'

If you are using Rails 2.1 you should look into Gem Dependencies.

== LICENSE:

(The MIT License)

Copyright (c) 2008 Paul Horsfall

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.