Rails Active Storage and existing cloud Storage objects

Viewed 59

Trying to figure out a way to attach existing Cloud Storage objects to a has_one_attached or a has_many_attached attribute on the Rails side.

For example, if I was to run a Cloud Function and have it put the resulting files directly back into Cloud Storage, I would need the Cloud function to then pass a JSON array back to the app to give Active Storage the object keys

Reading the Rails API docs, one method shown was:

person.avatar.attach(params[:signed_blob_id])

So, once the function uploads it to the bucket, it should obtain the object's blob_id, and pass that back to the Rails app to attach it to the model?

0 Answers
Related