I’m trying to find and replace some broken images left over from our forum migration to Discourse and have had great success (love the remap command!) but it’s not finding anything to replace for these examples and I can’t see anything wrong, can you?
Oh, hang on, some of these images are working. Is this Discourse attachment functionality? Is there some custom rendering logic going on as opposed to these being HTML strings in the database?
But this one doesn’t. I can have the file in cloud blob storage so would either like to import it into Discourse or just have it referenced from blob storage:
raw is the field where the text you see in the editor is. The stuff you are replacing is what you see if you edit the post in the ux, right? (cooked is the stuff that’s been processed and is what gets displayed.)
Doing stuff to re-write the posts. This is might be just enough to make you dangerous:
bps = Post.where("raw like '%//SOME-STRING%'")
bps.each do |post|
post.raw.gsub!(/OLD/,'NEW')
post.save
end
The advantage over the rake task is that you don’t have multiple levels of espaping to navigate.