FIX: `find_each` uses `find_in_batches` which uses the primary key as the order.
This commit is contained in:
parent
0b965e02b1
commit
5da768b4fe
|
@ -18,7 +18,7 @@ task 'posts:fix_letter_avatars' => :environment do
|
||||||
rebaked = 0
|
rebaked = 0
|
||||||
total = search.count
|
total = search.count
|
||||||
|
|
||||||
search.order(updated_at: :asc).find_each do |post|
|
search.find_each do |post|
|
||||||
rebake_post(post)
|
rebake_post(post)
|
||||||
print_status(rebaked += 1, total)
|
print_status(rebaked += 1, total)
|
||||||
end
|
end
|
||||||
|
@ -48,7 +48,7 @@ task 'posts:rebake_match', [:pattern, :type] => [:environment] do |_,args|
|
||||||
rebaked = 0
|
rebaked = 0
|
||||||
total = search.count
|
total = search.count
|
||||||
|
|
||||||
search.order(updated_at: :asc).find_each do |post|
|
search.find_each do |post|
|
||||||
rebake_post(post)
|
rebake_post(post)
|
||||||
print_status(rebaked += 1, total)
|
print_status(rebaked += 1, total)
|
||||||
end
|
end
|
||||||
|
@ -71,7 +71,7 @@ def rebake_posts(opts = {})
|
||||||
total = Post.count
|
total = Post.count
|
||||||
rebaked = 0
|
rebaked = 0
|
||||||
|
|
||||||
Post.order(updated_at: :asc).find_each do |post|
|
Post.find_each do |post|
|
||||||
rebake_post(post, opts)
|
rebake_post(post, opts)
|
||||||
print_status(rebaked += 1, total)
|
print_status(rebaked += 1, total)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue