I have followed the instructions from https://github.com/carrierwaveuploader/carrierwave#setting-the-content-type
so I got:
require 'carrierwave/processing/mime_types'
class AssetFileUploader < CarrierWave::Uploader::Base
include CarrierWave::MimeTypes
process :set_content_type
...
but after a file upload the content_type is not updated.
I have a AssetInfo model with a uploader AssetFileUploader mounted on
:file attribute
class AssetInfo < ActiveRecord::Base
mount_uploader :file, AssetFileUploader
...
The params contain:
... "file"=># @headers="Content-Disposition: form-data; name=\"asset[asset_info_attributes][file]\"; filename=\"img.jpg\"\r\nContent-Type: image/jpeg\r\n"> ...
After the file upload I try in the console:
AssetInfo.last.file.file => < CarrierWave::SanitizedFile:0x34b1c @original_filename=nil @content_type=nil @file="/home/reea/projects/ruby/learning_cms/public/uploads/asset_info/file/20/img.jpg">
AssetInfo.last.file.file.content_type => nil