paginate_each with conditions
Reported by Matt Aimonetti | April 10th, 2008 @ 06:11 PM
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?
Thanks,
-Matt
Comments and changes to this ticket
-
Mislav April 10th, 2008 @ 06:37 PM
- → 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 April 10th, 2008 @ 06:38 PM
- → State changed from resolved to invalid
-

Matt Aimonetti April 10th, 2008 @ 10:30 PM
- → 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 Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
