You can do this to create a local copy of the file. If it is on S3 will be loaded.
tmp_file = @model.attached_file.to_file => TempFile<...>
Then you can perform operations on this TempFile. When you don:
@model.attached_file = tmp_file
@model.save
Edit: read your question incorrectly. You can use the hooks before_post_processand after_post_processto perform tasks before or after the file processing.
class Model < AR::Base
has_attached_file :avatar
after_post_process :ping_webservice
private
def ping_webservice
end
end
source
share