Last active
May 17, 2023 20:26
-
-
Save dwilkie/3173f091c784d266e1081fb90bbc37b4 to your computer and use it in GitHub Desktop.
Migrate from Refile to ActiveStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CallDataRecord.find_each do |cdr| | |
next if cdr.file.attached? | |
cdr_url = "https://s3-ap-southeast-1.amazonaws.com/cdr.somleng.org/store/#{cdr.file_id}" | |
cdr.file.attach( | |
io: open(cdr_url), | |
filename: cdr.file_filename, | |
content_type: cdr.file_content_type | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment