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.

collection#replace does not return it's predecessor's value

#131

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

Reported by Elijah Miller · October 16th, 2007 @ 01:35 PM

State: resolved
Milestone: none
Assigned to: Mislav Mislav

Activity

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

    October 16th, 2007 @ 07:58 PM

  2. Mislav
    Mislav

    Thanks! I will fix it as soon as I get home.

    October 18th, 2007 @ 03:35 PM

  3. Chris Wanstrath
    Chris Wanstrath

    (from [409]) WillPaginate::Collection#replace now returns the result of supercall. [Elijah Miller] [#131 status:resolved]

    http://plugins.require.errtheblo...

    October 19th, 2007 @ 02:13 AM

  4. Mislav
    Mislav
    • State changed from open to resolved

    Hmm, either Lighthouse API changed or autoclosing tickets doesn't work anymore.

    October 19th, 2007 @ 02:15 AM

  5. Chris Wanstrath
    Chris Wanstrath

    state:resolved, not status

    October 19th, 2007 @ 02:21 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.