public
Description: Ruby and Rails core extensions used by GitHub.
Clone URL: git://github.com/github/hubahuba.git
defunkt (author)
Sat May 10 21:51:47 -0700 2008
commit  52a27da4d5aea71401bda44094fb6b4113b90b2c
tree    38cd27eb17194773d06fa9e01a5611aeff01731a
hubahuba / lib / active_record.rb
100644 11 lines (10 sloc) 0.295 kb
1
2
3
4
5
6
7
8
9
10
11
class << ActiveRecord::Base
  def each(limit = 1000)
    rows = find(:all, :conditions => ["id > ?", 0], :limit => limit)
    until rows.blank?
      rows.each { |record| yield record }
      rows = find(:all, :conditions => ["id > ?", rows.last.id], :limit => limit)
    end
    self
  end
end