use default rails logger during the first template import + remove some carrierwave method patches now useless with the new version of the gem
This commit is contained in:
parent
cd428e467c
commit
de217b74b7
@ -27,7 +27,7 @@ module Extensions
|
|||||||
begin
|
begin
|
||||||
Locomotive::Import::Job.run!(source, site, { :samples => true })
|
Locomotive::Import::Job.run!(source, site, { :samples => true })
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
logger.error "The import of the site template failed because of #{e.message}"
|
Rails.logger.error "The import of the site template failed because of #{e.message}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,33 +4,13 @@ module CarrierWave
|
|||||||
|
|
||||||
class SanitizedFile
|
class SanitizedFile
|
||||||
|
|
||||||
def original_filename=(filename)
|
|
||||||
@original_filename = filename
|
|
||||||
end
|
|
||||||
|
|
||||||
def content_type=(content_type)
|
|
||||||
@content_type = content_type
|
|
||||||
end
|
|
||||||
|
|
||||||
# http://github.com/jnicklas/carrierwave/issuesearch?state=closed&q=content+type#issue/48
|
|
||||||
def copy_to_with_content_type(new_path, permissions=nil)
|
|
||||||
new_file = self.copy_to_without_content_type(new_path, permissions)
|
|
||||||
new_file.content_type = self.content_type
|
|
||||||
new_file
|
|
||||||
end
|
|
||||||
|
|
||||||
alias_method_chain :copy_to, :content_type
|
|
||||||
|
|
||||||
# FIXME (Did) CarrierWave speaks mime type now
|
# FIXME (Did) CarrierWave speaks mime type now
|
||||||
def content_type
|
def content_type_with_file_mime_type
|
||||||
return @content_type if @content_type
|
content_type_without_file_mime_type || File.mime_type?(original_filename)
|
||||||
if @file.respond_to?(:content_type) and @file.content_type
|
|
||||||
@file.content_type.chomp
|
|
||||||
else
|
|
||||||
File.mime_type?(@file) if @file.is_a?(String)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias_method_chain :content_type, :file_mime_type
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Uploader
|
module Uploader
|
||||||
|
Loading…
Reference in New Issue
Block a user