Follow up to 149411ec90
.
This commit is contained in:
parent
149411ec90
commit
3094a603b7
|
@ -266,12 +266,15 @@ class Upload < ActiveRecord::Base
|
||||||
)
|
)
|
||||||
|
|
||||||
remap_scope ||= begin
|
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
|
end
|
||||||
|
|
||||||
remap_scope.each do |post|
|
remap_scope.each do |post|
|
||||||
post.raw.gsub!(previous_url, upload.url)
|
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?
|
post.save! if post.changed?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue