Created
August 25, 2020 20:39
-
-
Save jrochkind/d9a7d80a477358f951b93fe19548c8ed to your computer and use it in GitHub Desktop.
A naive ruby S3 public URL generation implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def naive_public_url(shrine_file) | |
"https://#{["#{shrine_file.storage.bucket.name}.s3.amazonaws.com", *shrine_file.storage.prefix, shrine_file.id].join('/')}" | |
end | |
naive_public_url(model.image) | |
#=> "https://somebucket.s3.amazonaws.com/path/to/image.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment