fix attachment uploader for aws
This commit is contained in:
parent
2d83e43db0
commit
ab19196391
|
@ -8,6 +8,15 @@ class AttachmentUploader < CarrierWave::Uploader::Base
|
|||
end
|
||||
|
||||
def image?
|
||||
%w(png jpg jpeg).include?(file.extension)
|
||||
img_ext = %w(png jpg jpeg)
|
||||
if file.respond_to?(:extension)
|
||||
img_ext.include?(file.extension)
|
||||
else
|
||||
# Not all CarrierWave storages respond to :extension
|
||||
ext = file.path.split('.').last
|
||||
img_ext.include?(ext)
|
||||
end
|
||||
rescue
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue