engine/lib/locomotive/carrierwave/patches.rb

33 lines
604 B
Ruby
Raw Normal View History

2010-05-11 21:38:52 +00:00
module CarrierWave
2010-05-11 21:38:52 +00:00
class SanitizedFile
2010-05-11 21:38:52 +00:00
# FIXME (Did) CarrierWave speaks mime type now
def content_type_with_file_mime_type
content_type_without_file_mime_type || File.mime_type?(original_filename)
2010-05-11 21:38:52 +00:00
end
alias_method_chain :content_type, :file_mime_type
2010-05-11 21:38:52 +00:00
end
module Uploader
class Base
def build_store_dir(*args)
default_dir = self.class.store_dir
if default_dir.blank? || default_dir == 'uploads'
File.join(args.map(&:to_s))
else
File.join([default_dir] + args.map(&:to_s))
end
end
end
end
2010-05-11 21:38:52 +00:00
end