How do I change ActionText Attachment url (domain name)?

We are trying to migrate our Rails app from Heroku to AWS and change the domain name. The problem is that the url in ActionText::Attachment does not change after the data migration. we are using ActiveStorage and S3.

For example.

  • Heroku domain name:
  • AWS domain name:
# app/models/message.rb
class Message < ApplicationRecord
  has_rich_text :content
# rails console
> Message.last.content.body.attachments.first
=> #<ActionText::Attachables attachable=#<ActionText::Attachables::RemoteImage:0x00007f3a28669c48 @url="", @content_type="image/png", @width="92", @height="88">>

As shown above, the URL of the attachment in the ActionText is still instead of after data migration.

Is there any way to correct the url in ActionText::Attachment to the domain name after the data migration (in this case, Or is there a way to modify just the path, not the url?