Follow up to 149411ec90
.
This commit is contained in:
parent
149411ec90
commit
3094a603b7
|
@ -266,12 +266,15 @@ class Upload < ActiveRecord::Base
|
|||
)
|
||||
|
||||
remap_scope ||= begin
|
||||
Post.with_deleted.where("raw ~ '/uploads/default/\\d+/'").all
|
||||
Post.with_deleted
|
||||
.where("raw ~ '/uploads/default/\\d+/'")
|
||||
.select(:raw, :cooked)
|
||||
.all
|
||||
end
|
||||
|
||||
remap_scope.each do |post|
|
||||
post.raw.gsub!(previous_url, upload.url)
|
||||
post.cooked.sub!(previous_url, upload.url)
|
||||
post.cooked.gsub!(previous_url, upload.url)
|
||||
post.save! if post.changed?
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue