remove ALL useless 'order by'

This commit is contained in:
Régis Hanol 2015-05-12 09:37:48 +02:00
parent 232b5387d0
commit 54b63bfdbf

View file

@ -34,7 +34,7 @@ task "uploads:migrate_from_s3" => :environment do
puts "Migrating uploads from S3 to local storage" puts "Migrating uploads from S3 to local storage"
puts puts
Upload.order(:id).find_each do |upload| Upload.find_each do |upload|
# remove invalid uploads # remove invalid uploads
if upload.url.blank? if upload.url.blank?
@ -100,7 +100,7 @@ task "uploads:clean_up" => :environment do
## ##
# uploads & avatars # uploads & avatars
Upload.order(:id).find_each do |upload| Upload.find_each do |upload|
path = "#{public_directory}#{upload.url}" path = "#{public_directory}#{upload.url}"
if !File.exists?(path) if !File.exists?(path)
upload.destroy rescue nil upload.destroy rescue nil
@ -111,7 +111,7 @@ task "uploads:clean_up" => :environment do
end end
# optimized images # optimized images
OptimizedImage.order(:id).find_each do |optimized_image| OptimizedImage.find_each do |optimized_image|
path = "#{public_directory}#{optimized_image.url}" path = "#{public_directory}#{optimized_image.url}"
if !File.exists?(path) if !File.exists?(path)
optimized_image.destroy rescue nil optimized_image.destroy rescue nil
@ -172,7 +172,7 @@ task "uploads:missing" => :environment do
end end
Upload.order(:id).find_each do |upload| Upload.find_each do |upload|
# could be a remote image # could be a remote image
next unless upload.url =~ /^\/[^\/]/ next unless upload.url =~ /^\/[^\/]/
@ -187,7 +187,7 @@ task "uploads:missing" => :environment do
puts path if bad puts path if bad
end end
OptimizedImage.order(:id).find_each do |optimized_image| OptimizedImage.find_each do |optimized_image|
# remote? # remote?
next unless optimized_image.url =~ /^\/[^\/]/ next unless optimized_image.url =~ /^\/[^\/]/