Skip to content

Instantly share code, notes, and snippets.

@jrochkind
Created August 25, 2020 20:39
Embed
What would you like to do?
A naive ruby S3 public url generation
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