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.

will_paginate: fails when using :group option

#29

when using the :group option with Rails 1.2.3, ActiveRecord will return an ordered hash which causes a problem with the count statement on line 28 of the file finder.rb. The following error is returned:

undefined method `to_i' for #<activesupport::orderedhash:0x99c4470>

this can be fixed by using the following:

num = count(count_options)

num.class == Fixnum ? num : num.length

unless there's a better way of doing it..

also, the following code on line 27 needs to be merge! and not merge, since merge returns a new hash, rather than modifying it in place, as was intended.

count_options.merge(options.delete(:count)) if options[:count]

Reported by Mike Garey · June 11th, 2007 @ 01:09 AM

State: resolved
Milestone: none
Assigned to: Mislav Mislav

Activity

  1. Chris Wanstrath
    Chris Wanstrath
    • State changed from new to resolved

    (from [254]) Fix use of :group option with will_paginate [Mike Garey] [#29 state:resolved]

    http://require.errtheblog.com/pl...

    June 11th, 2007 @ 01:09 AM

  2. Mislav
    Mislav

    Nice report and suggestions, Mike! I was just about to use :group in my project and was wondering if will_paginate will choke when I saw the changeset :D

    June 11th, 2007 @ 01:09 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.