Custom AWS Params

Sample to add and read extra attribute from AWS for each file:

def my_hook_for_on_uploader(args)
args[:aws_settings][:aws_file_upload_settings] = lambda{|settings|
settings[:cache_control] = 'max-age=36001, public'
settings
}
args[:aws_settings][:aws_file_read_settings] = lambda{|data, s3_file| unless s3_file.is_a?(String)
data[:cache_control] = (s3_file.is_a?(Aws::S3::ObjectSummary) ? s3_file.object : s3_file).cache_control
end
data
}
end

The result of reading file is like:
{
"name" : "one.jpg",
"key" : "/one.jpg",
"url" : "https://abcd.cloudfront.net/one.jpg",
"is_folder" : false,
"size" : 100476.0,
"format" : "image",
"deleteUrl" : "",
"thumb" : "https://abcd.cloudfront.net/thumb/one-jpg.jpg",
"type" : "",
"created_at" : "2016-10-26T10:37:59.000-04:00",
"dimension" : "",
"cache_control" : "max-age=36001, public"
}

More AWS attributes here:
http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#upload_file-instance_method