Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Array#paginate is inconsistent with collection#paginate

#128

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.

Reported by ckknight · October 10th, 2007 @ 11:40 PM

State: resolved
Milestone: none
Assigned to: Mislav Mislav

Activity

  1. Mislav
    Mislav
    • Assigned user changed from Chris Wanstrath to Mislav
    • State changed from new to open

    October 13th, 2007 @ 03:17 AM

  2. Chris Wanstrath
    Chris Wanstrath

    (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...

    October 14th, 2007 @ 01:50 AM

  3. Mislav
    Mislav
    • State changed from open to resolved

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

    October 14th, 2007 @ 01:52 AM

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.