rails version 5.2
I have a scenario that I need to access the public url of Rails Active Storage with Amazon s3 to make a zip file with Sidekiq bac
A bit late, but you can get the public URL also like this (assuming a Post model with a single attached header_image as in the example above):
@post.header_image.service.send(:object_for, @post.header_image.key).public_url
Update 2020-04-06
You need to make sure, that the document is saved with public ACLs (e.g. setting the default to public)
rails_blob_url is also usable. Requests will be served by rails, however, those requests will be probably quite slow, since a private URL needs to be generated on each request.
(FYI: outside the controller you can generate that URL also like this: Rails.application.routes.url_helpers.rails_blob_url(@post, only_path: true)
)