29 lines
563 B
Ruby
29 lines
563 B
Ruby
class JamTrackUploader < CarrierWave::Uploader::Base
|
|
# include CarrierWaveDirect::Uploader
|
|
include CarrierWave::MimeTypes
|
|
|
|
process :set_content_type
|
|
|
|
def initialize(*)
|
|
super
|
|
JamRuby::UploaderConfiguration.set_aws_private_configuration(self)
|
|
end
|
|
|
|
# Add a white list of extensions which are allowed to be uploaded.
|
|
def extension_white_list
|
|
%w(jka)
|
|
end
|
|
|
|
def store_dir
|
|
nil
|
|
end
|
|
|
|
def md5
|
|
@md5 ||= ::Digest::MD5.file(current_path).hexdigest
|
|
end
|
|
|
|
def filename
|
|
"#{model.store_dir}/#{model.filename}" if model.id
|
|
end
|
|
end
|