Want more GoRails?
GoRails is packed full with 719 lessons just like this one.
Sign up to get full access or log in to your account and sit back.
Your Teacher
Chris Oliver
Hi, I'm Chris. I'm the creator of GoRails, Hatchbox.io and Jumpstart. I spend my time creating tutorials and tools to help Ruby on Rails developers build apps better and faster.
About This Episode
Rails 7 changed the way ActionText attachments work, so we'll be writing a Rake task to walk through each of the embeds and update them with the correct Signed GlobalID.
Notes
If you're seeing 404s on your ActionText attachments all of a sudden, you might have changed your Rails application defaults from 6.x to 7.0 recently. I noticed this affected the forums on one of my Rails applications, so I got digging and found out that algorithm changed between the Rails versions. This is fine, but there's no built-in way to update the SGIDs for the embedded attachments in ActionText::RichText records.
This episode, we'll walk through how to find all the embeds in your RichText records, parse the HTML, read the old GlobalIDs and then update them with new Signed GlobalIDs.