From 5da768b4fec40cbea05df30c75f4f0b897f05e9e Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 25 Aug 2016 16:10:27 +0800 Subject: [PATCH] FIX: `find_each` uses `find_in_batches` which uses the primary key as the order. --- lib/tasks/posts.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/posts.rake b/lib/tasks/posts.rake index b982ad1fb..dbb8ccf26 100644 --- a/lib/tasks/posts.rake +++ b/lib/tasks/posts.rake @@ -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