public
Fork of guillermo/active_record_each
Description: Implements ActiveRecord::Base.each instance method
Homepage: http://github.com/guillermo/active_record_each/wikis
Clone URL: git://github.com/collectiveidea/active_record_each.git
use #step to make the slow_each more clear
brandon (author)
Wed Jul 23 13:29:19 -0700 2008
commit  2223d8ab76bbf5b8852d32e10f642f52fd17efd1
tree    451f26ac74a8a7243bd30949b8cfc8ae94e50682
parent  e5de77f4a10bdd69e8f301812864b3daa1f2f06b
...
28
29
30
31
32
33
 
 
34
35
36
...
28
29
30
 
 
 
31
32
33
34
35
0
@@ -28,9 +28,8 @@ class ActiveRecord::Base
0
     end
0
     
0
     def slow_each(options, &block)
0
- records = count(options)
0
- (records.to_f / options[:limit]).ceil.times do |i|
0
- find(:all, options.merge(:offset => i * options[:limit])).each(&block)
0
+ 0.step(count(options), options[:limit]) do |offset|
0
+ find(:all, options.merge(:offset => offset)).each(&block)
0
       end
0
     end
0
 

Comments

    No one has commented yet.