Ask A Question

Notifications

You’re not receiving notifications from this thread.

How can I get a file object from active storage to attach to a different model?

Brian Carpenter asked in Rails

I'd like to access a file object that already exists in active storage and re-attach it to another model. Something like
@newmodel.image.attach(file_object_already_in_active_storage)

Is this possible?

Variations of rails_blob_path and url_for methods produce invalid signature errors.

Reply

Found this link on how to reference a blob for use with another model.

https://github.com/rails/rails/issues/31674

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,387+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.