A naive ruby S3 public url generation
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