Substituir uma string em todas as postagens

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
# cole o código aqui

Talvez faça um backup primeiro.

2 curtidas