#245 ✓resolved
Tobi

paginated_each on named_scope keeps scope within block call

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

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

Comments and changes to this ticket

  • Mislav

    Mislav October 7th, 2008 @ 10:51 AM

    • Assigned user changed from “Chris Wanstrath” to “Mislav”
    • State changed from “new” to “resolved”

    Applied (with changes) in 068702d, thanks

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

Attachments

Pages