#131 ✓resolved
Elijah Miller

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

Comments and changes to this ticket

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