The OP question was how to handle files that are not images.
Please see this source file on GitHub:
carrierwave / lib / carrierwave / uploader / processing.rb and check the comments.
You will create your own subclass of the CarrierWave class and set it in your model as follows:
def MyModel < ActiveRecord::Base
mount_uploader :uploaded_file, MyUploader
...
end
, ActiveRecord :uploaded_file.
, :uploaded_file CarrierWave .
:
class MyUploader < CarrierWave:Uploader::Base
process :my_custom_processing => [param1,param2,param3]
def my_custom_processing(param1,param2,param3)
...
my_nifty_file_processor( self.uploaded_file )
uploaded_data = self.uploaded_file.read
...
end
end
my_nifty_file_processor read , .
CarrierWave read Uploader (= ), .
:
ActiveRecord , .
, :
self.model
, , AR.