#128 ✓resolved
ckknight

Array#paginate is inconsistent with collection#paginate

Reported by ckknight | 2007-10-10 23:40:53 UTC

Currently, Array#paginate's API is in the form of

[1,2,3].paginate(page=1, per_page=15)

whereas Rails' collections use the form

myCollection.paginate(:page => 1, :per_page => 30, :total_entries => num)

Now there's multiple issues with this:

1) using a tuple of options instead hash-style options

2) different per_page

3) Depending on the environment (e.g. test vs. development), one method can return an Array while in test or a collection in development.

I've attached a diff of what I think should allay this issue.

Comments and changes to this ticket

  • Mislav

    Mislav 2007-10-13 03:17:38 UTC

    • Assigned user changed from “Chris Wanstrath” to “Mislav”
    • State changed from “new” to “open”
  • Chris Wanstrath

    Chris Wanstrath 2007-10-14 01:50:31 UTC

    (from [406]) Will Paginate: add WillPaginate::Deprecation that builds on ActiveSupport::Deprecation. Change Array#paginate API to match ActiveRecord::Base#paginate; so you will no longer write array.paginate(1, 20), but array.paginate(:page => 1, :per_page => 20). Mark the old API as deprecated; it will be removed in the future. [ckknight] [#128 status:resolved]

    http://plugins.require.errtheblo...

  • Mislav

    Mislav 2007-10-14 01:52:46 UTC

    • State changed from “open” to “resolved”

    Why didn't the commit hook close this, I wonder

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Attachments

Pages