Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. batch.each do |s|
  2.         if @file
  3.           @file.close
  4.           @file = nil
  5.         end        
  6.         begin
  7.           i+=1
  8.           next if s.thumbnail.exists? || !s.feature_image.exists?
  9.           @file = File.open(s.feature_image.path)
  10.           s.thumbnail = @file
  11.           s.save!
  12.           if @file
  13.             @file.close
  14.           end
  15.         rescue Exception => e
  16.           log_error(err, s, e)
  17.         end
  18.       end
  19.     end