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.