Accept custom AR relation for UploadRecovery.

This commit is contained in:
Guo Xiang Tan
2018-09-13 16:32:35 +08:00
parent 6c65718301
commit 0a06b3d977
2 changed files with 10 additions and 2 deletions

View File

@ -3,8 +3,8 @@ class UploadRecovery
@dry_run = dry_run
end
def recover
Post.where("raw LIKE '%upload:\/\/%'").find_each do |post|
def recover(posts = Post)
posts.where("raw LIKE '%upload:\/\/%'").find_each do |post|
begin
analyzer = PostAnalyzer.new(post.raw, post.topic_id)
cooked_stripped = analyzer.send(:cooked_stripped)