Upcoming changes to pagination

20 views
Skip to first unread message

Ryan Heneise

unread,
Dec 9, 2010, 5:21:23 PM12/9/10
to Donor Tools API
Hi folks,

In order to provide forward compatibility with Rails 3, we are making
some changes to the way our pagination works.

APIs that are specifically affected by this change:
* Donations GET /donations.xml
* Personas GET /personas.xml

The change has to do with the way that the pagination information is
returned by a GET query.

The old way returns pagination data like this:

<personas>
<current_page type="integer">2</current_page>
<per_page type="integer">50</per_page>
<total_entries type="integer">1266</total_entries>
...
</personas>

The new way will return the data like this:

<personas type="array" current_page="1" per_page="2"
total_entries="624">
...
</personas>

If you're running our fork of the [WillPaginate gem](https://
github.com/mysmallidea/will_paginate/) note that it will NO LONGER
WORK on the client side with the new pagination system.


## Upgrading

Be sure to remove any gem dependencies to our old fork of WillPaginate

### Rails 2

For Rails 2.x apps, simply require [the original WillPaginate gem]
(https://github.com/mislav/will_paginate/), along with [PoxPaginate]
(https://github.com/c42/pox_paginate)

config.gem 'will_paginate'
config.gem "pox_paginate", :version => '>= 0.1.0', :lib =>
"pox_paginate"

### Rails 2 with Bundler

gem 'will_paginate'
gem 'pox_paginate', '>= 0.1.0'

### Rails 3

For Rails 3, add the following to your Gemfile:

gem 'will_paginate', '~> 3.0.beta'
gem 'pox_paginate'


## When will these changes happen?

We will roll out these changes in two phases.

### Phase 1: Monday, December 13, 2010

We will revert to the default will_paginate gem, which removes all
pagination. If you're using our old WillPaginate fork, it should still
work, but the per_page, total_pages, and total_entries variables will
no longer be sent.

### Phase 2: Tuesday, December 14, 2010

We will deploy the PoxPaginate gem, which will restore pagination
options, as explained above.

This should give you time to deploy any needed changes to your apps.

I'm really sorry for any hassle this causes you - please send me your
feedback if this ruins your day. However, in the long run I think it
will be worthwhile as we work for full Rails 3 support.

OneBody Support

unread,
Dec 9, 2010, 5:23:20 PM12/9/10
to donor-t...@googlegroups.com
Ryan, thanks for this change. Had a bit of a problem in OneBody getting this to work with Rails 3, and glad you are making the update.

-Tim

Ryan

unread,
Dec 15, 2010, 12:19:36 PM12/15/10
to Donor Tools API
Ryan-

Was this implemented on Tuesday? I'm still getting the same error (and
old xml structure).

-Ryan

Ryan Heneise

unread,
Dec 15, 2010, 1:31:18 PM12/15/10
to donor-t...@googlegroups.com
Hi Ryan,

I'm sorry about that - we had trouble deploying the intermediate step on Monday. We just deployed with the updated pagination code.

You should now be able to paginate the XML results.

As a reminder, please install the PoxPaginate gem, like so:

# Gemfile


gem 'will_paginate'
gem 'pox_paginate', '>= 0.1.0'

Let me know how it works for you.

Ryan H.

Ryan Wood

unread,
Dec 15, 2010, 3:31:27 PM12/15/10
to donor-t...@googlegroups.com
Thanks Ryan. Looks like it's working now. By the way, is there a way to search for a Persona (based on part of a company name or email, for instance) using ActiveResource (and Rails)? 

-Ryan

Ryan Wood

unread,
Dec 15, 2010, 3:40:50 PM12/15/10
to donor-t...@googlegroups.com
Nevermind... Figured it out.

Persona.find(:all, :params => { :search => 'baptist' })

Nice.

-Ryan

Ryan Heneise

unread,
Dec 15, 2010, 4:49:22 PM12/15/10
to donor-t...@googlegroups.com
Ryan, 

Yep, you got it! 

Ryan H. 
Reply all
Reply to author
Forward
0 new messages