public
Description: Paperclip File Management Plugin
Homepage: http://www.thoughtbot.com/projects/paperclip
Clone URL: git://github.com/thoughtbot/paperclip.git
Rake tasks don't load all instances into memory.
jyurek (author)
Wed Jul 09 19:43:28 -0700 2008
commit  fb08a5335a64585eed4b6c9e540f466d6fc9efc7
tree    cdf86164b257a26b87e8d86edebe88857624d0ca
parent  aff3396ed981259fa44a929bfadea9adc1628ac0
...
15
16
17
18
19
20
 
 
 
21
22
 
 
23
24
25
...
15
16
17
 
 
 
18
19
20
21
 
22
23
24
25
26
0
@@ -15,11 +15,12 @@ def obtain_attachments
0
 end
0
 
0
 def for_all_attachments
0
- klass = obtain_class
0
- names = obtain_attachments
0
- instances = klass.find(:all)
0
+ klass = obtain_class
0
+ names = obtain_attachments
0
+ ids = klass.connection.select_values("SELECT id FROM #{klass.table_name}")
0
 
0
- instances.each do |instance|
0
+ ids.each do |id|
0
+ instance = klass.find(id)
0
     names.each do |name|
0
       result = if instance.send("#{ name }?")
0
                  yield(instance, name)

Comments

    No one has commented yet.