-
-
Save bogdanRada/640dba20154ca5ff7a7e2f9d2ef2b0a4 to your computer and use it in GitHub Desktop.
Blob observer
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
class BlobObserver < ActiveRecord::Observer | |
observe ActiveStorage::Blob | |
def after_save(blob) | |
blob.update_columns(storage_url: "https://s3-#{ENV['AWS_AS_S3_REGION']}.amazonaws.com/#{ENV['AWS_AS_S3_BUCKET']}/" + blob.key) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment