ActiveRecord upload complete callback
class User < ApplicationRecord
has_one_attached :avatar
validates :username, presence: true
after_save do
if avatar.attached? && (Time.now - avatar.attachment.created_at)<5
Rails.logger.info "avatar change detected"
end
end
endcurl --location http://localhost:3001/api/users/1/avatar.json > downloaded_avatar.png
curl --include --request POST http://localhost:3001/api/users --form "user[username]=Test User" --form "user[avatar]=@/Users/rhee/Desktop/sam.mp4"
https://stackoverflow.com/questions/53226228/callback-for-active-storage-file-upload
https://www.zweitag.de/en/blog/active-storage-rails-api-apps