Skip to content

Instantly share code, notes, and snippets.

@jrochkind
Created August 25, 2020 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrochkind/8b2a0cf539c3ebc916102b961d1aef22 to your computer and use it in GitHub Desktop.
Save jrochkind/8b2a0cf539c3ebc916102b961d1aef22 to your computer and use it in GitHub Desktop.
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