Replace a string in all posts

Topics.where(category_id: 123).each do |t|
  posts.where(topic_id: t).each do |p|
    p.raw.gsub!("replaceme","/")
    p.save
  end
end
./launcher enter app
rails c
# ここに貼り付けます

最初にバックアップを作成することをお勧めします。

「いいね!」 2