Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

paginating_find: A paginating finder for Rails

By Peter Cooper / August 29, 2006

This isn't particularly new, alas, but still interesting:


Got 15,842 records that you’d like to export to a file? Using the standard the Rails ActiveRecord::Base#find method will load all 15,842 into memory all at once and return them all in an array. If your app is running on a shared host, or if you’re keeping your app on a memory budget, this is a big problem for you. So you could load each record one by one, but that’ll kill your db server. Wouldn’t it be sweet if #find could return an enumerable that would load your records in batches of say 1,500 records? Well with my new nifty-jifty paginating_find plugin, it can.

Alex Wolfe has the skinny.

Other Posts to Enjoy

Twitter Mentions