Created
September 10, 2019 09:23
-
-
Save mihaic195/1aed3eb8b45be6b59af44c0185d5cc88 to your computer and use it in GitHub Desktop.
Simple sql query for extracting the direct URL of an attachment
This file contains hidden or 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
| SELECT blobs.storage_url | |
| FROM active_storage_blobs AS blobs | |
| INNER JOIN active_storage_attachments AS attachments ON attachments.blob_id = blobs.id | |
| WHERE attachments.record_type = 'Model1' | |
| AND attachments.name = 'logo' | |
| LIMIT 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment