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.

paginated_each on named_scope keeps scope within block call

#245

I found a bug when calling paginated_each on a named_scope. If you use the same find within the block, the scope still exists, bubt shouldn't. Using rails 'with_exclusive_scope' method solves the problem

Example (taken from test case) we have 11 Developers, incl. 2 poor Developer:

calling paginated_each on Developer.poor shouldn't apply the named_scope on further calls within the block. Therefore this should work:

assert_equal 2, Developer.poor.paginated_each(:per_page => 1) {

    assert_equal 11, Developer.count

}

Unfortunately this test fails. See attached patch (including test case) for fix

Cheers Tobi

Reported by Tobi · September 19th, 2008 @ 04:21 PM

State: resolved
Milestone: none
Assigned to: Mislav Mislav

Activity

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

    Applied (with changes) in 068702d, thanks

    October 7th, 2008 @ 10:51 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.