-
-
Save bogdanRada/a03b573e8f5804cb3c085a9b1fb2efbe 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