will_paginate: fails when using :group option
Reported by Mike Garey | June 11th, 2007 @ 01:09 AM
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]
Comments and changes to this ticket
-
Chris Wanstrath June 11th, 2007 @ 01:09 AM
- State changed from new to resolved
(from [254]) Fix use of :group option with will_paginate [Mike Garey] [#29 state:resolved]
-
Mislav June 11th, 2007 @ 01:09 AM
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
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.
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!