Reputation: 12593
I am migrating from deprecated paperclip gem to ActiveStorage
and wondering how can I get hold of attachment URL in the model (for example if I want to add it to custom as_json
method, some elasticshearh data etc.)
Couldn't find anything in documentation for that particular use case.
Upvotes: 2
Views: 2121
Reputation: 160
file = fetch_your_file
link = rails_blob_path(file, disposition: 'attachment')
will return the attachment link
Upvotes: 2