Quick and to the point: remember to re-associate ActiveStorage::Attachment
s if you change a table name otherwise you won't see previously attached files.
Relationships are referenced by attachments with the record_type
attribute where record_type
is the name of the model. Here is an example attachment where the model name is Training::Hike
:
#<ActiveStorage::Attachment id: 8, name: "files", record_type: "Training::Hike", record_id: 1, blob_id: 9, created_at: "2018-04-23 13:54:27">
Once you update the table name (and the models and controllers and the file names etc etc) update the record_type
with a simple query:
ActiveStorage::Attachment
.where(record_type: 'Training::Hike')
.update(record_type: 'Training::NewModelName')
Now you just have to update all those tests ;)