-
Notifications
You must be signed in to change notification settings - Fork 1.7k
How to: use callbacks
Pavel edited this page Aug 11, 2015
·
6 revisions
Callbacks allow you to hook in your own code when a particular CarrierWave event occurs. The following callbacks are available for use in CarrierWave uploaders:
- :cache
- :retrieve_from_cache
- :store
- :retrieve_from_store
- :remove
class MyUploader < CarrierWave::Uploader::Base
#....
after :cache, :unlink_original
def unlink_original(file)
return unless delete_original_file
File.delete if version_name.blank?
end
end