FIX: `find_each` uses `find_in_batches` which uses the primary key as the order.

This commit is contained in:
Guo Xiang Tan 2016-08-25 16:10:27 +08:00
parent 0b965e02b1
commit 5da768b4fe
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ task 'posts:fix_letter_avatars' => :environment do
rebaked = 0
total = search.count
search.order(updated_at: :asc).find_each do |post|
search.find_each do |post|
rebake_post(post)
print_status(rebaked += 1, total)
end
@ -48,7 +48,7 @@ task 'posts:rebake_match', [:pattern, :type] => [:environment] do |_,args|
rebaked = 0
total = search.count
search.order(updated_at: :asc).find_each do |post|
search.find_each do |post|
rebake_post(post)
print_status(rebaked += 1, total)
end
@ -71,7 +71,7 @@ def rebake_posts(opts = {})
total = Post.count
rebaked = 0
Post.order(updated_at: :asc).find_each do |post|
Post.find_each do |post|
rebake_post(post, opts)
print_status(rebaked += 1, total)
end