#206 ✓invalid
Matt Aimonetti (mattetti)

paginate_each with conditions

Reported by Matt Aimonetti (mattetti) | April 11th, 2008 @ 03:11 AM

Hey Mislav, it looks like I found a tiny bug in WP 2.2.1

I wanted to use the awesome new paginate_each method with a condition and tried the following:

User.paginate_each(:page => 1, :conditions => ["user.zip_code IN (?)", @zip_codes])

The first thing was that it forced to manually enter a page number, which is not the case when I don't use a conditions, the second id that it raised an error:

NoMethodError: undefined method `find_each' for #

from vendor/rails/activerecord/lib/active_record/base.rb:1624:in `method_missing_without_paginate'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/finder.rb:164:in `method_missing'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/finder.rb:82:in `send'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/finder.rb:82:in `paginate'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/collection.rb:87:in `create'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/finder.rb:76:in `paginate'

from vendor/gems/will_paginate-2.2.1/lib/will_paginate/finder.rb:177:in `method_missing'

Am I missing something or is that a bug?



Comments and changes to this ticket

  • Mislav

    Mislav April 11th, 2008 @ 03:37 AM

    • State changed from “new” to “resolved”

    Hey Matt,

    It's paginated_each (you are missing a letter). I see how you got confused, but I think this name is more semantic with regard to what the method does.

  • Mislav

    Mislav April 11th, 2008 @ 03:38 AM

    • State changed from “resolved” to “invalid”
  • Matt Aimonetti (mattetti)

    Matt Aimonetti (mattetti) April 11th, 2008 @ 07:30 AM

    • Title changed from “pageinate_each with conditions” to “paginate_each with conditions”

    aaahhh I knew it was something stupid like that!

    I agree paginated is probably semantically better.

    Works great, I'm glad you added this feature. Btw you might want to document it in the readme file.

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