collection#replace does not return it's predecessor's value
Reported by Elijah Miller | October 16th, 2007 @ 01:35 PM
Array#replace: http://corelib.rubyonrails.org/c...
Array#replace returns the new array, Collection#replace returns nil and probably false or an Integer because of the total_entries conditional. I believe Collection#replace should simply add-on to Array#replace while retaining all of it's original uses. Here is the simple fix:
def replace(array)
value = super
# The collection is shorter then page limit? Rejoice, because
# then we know that we are on the last page!
if total_entries.nil? and length > 0 and length < per_page
self.total_entries = offset + length
end
value
end
Comments and changes to this ticket
-
Chris Wanstrath October 16th, 2007 @ 07:58 PM
- Assigned user changed from Chris Wanstrath to Mislav
- State changed from new to open
-
Chris Wanstrath October 19th, 2007 @ 02:13 AM
(from [409]) WillPaginate::Collection#replace now returns the result of supercall. [Elijah Miller] [#131 status:resolved]
-
Mislav October 19th, 2007 @ 02:15 AM
- State changed from open to resolved
Hmm, either Lighthouse API changed or autoclosing tickets doesn't work anymore.
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!