Commit fb08a533 by Jon Yurek

Rake tasks don't load all instances into memory.

parent aff3396e
......@@ -15,11 +15,12 @@ def obtain_attachments
end
def for_all_attachments
klass = obtain_class
names = obtain_attachments
instances = klass.find(:all)
klass = obtain_class
names = obtain_attachments
ids = klass.connection.select_values("SELECT id FROM #{klass.table_name}")
instances.each do |instance|
ids.each do |id|
instance = klass.find(id)
names.each do |name|
result = if instance.send("#{ name }?")
yield(instance, name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment