즉시 이것이 작동할지 아닌지는 모르겠습니다.
"T8"만 "T9"로 교체하려는 것이므로, 모든 슬래시를 제거하고 테스트해 보시는 건 어떨까요?
구문 오류에서 따옴표가 누락된 것으로 보입니다.
SyntaxError: unexpected integer literal, expecting ')'
topic.title.gsub!(/T8/2024/,"T9/2024")
^~~~
누락된 따옴표를 수정한 아래 코드를 시도해 보세요.
Topic.where("title LIKE '%T8/2024%'").find_each do |topic|
topic.title.gsub!("T8/2024","T9/2024")
topic.fancy_title.gsub!(/T8/2024","T9/2024")
topic.slug.gsub!("T8/2024","T9/2024")
puts topic.title
begin
topic.save!
rescue
puts "oops, something broke."
end
end
추가로 불필요한 "/"도 제거했습니다.