Skip to content

Commit

Permalink
Load models in batches, to make this more practical for large datasets.
Browse files Browse the repository at this point in the history
Note: find_each doesn't support order because it already specifies it.
And it happens to be 'id' as well.
  • Loading branch information
webmat authored and Sporky023 committed Mar 16, 2012
1 parent 0c1e812 commit 35052eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/paperclip.rb
Expand Up @@ -138,7 +138,7 @@ def register_processor(name, processor)
def each_instance_with_attachment(klass, name)
unscope_method = class_for(klass).respond_to?(:unscoped) ? :unscoped : :with_exclusive_scope
class_for(klass).send(unscope_method) do
class_for(klass).find(:all, :order => 'id').each do |instance|
class_for(klass).find_each do |instance|
yield(instance) if instance.send(:"#{name}?")
end
end
Expand Down

0 comments on commit 35052eb

Please sign in to comment.