HI my app works fine locally when using :file but once i'ts pushed up to heroku and using S3 I get this error when trying to upload. It looks to be a porblem with the def filename method.
The heroku logs show:
NoMethodError (undefined method `extension'开发者_StackOverflow for #<CarrierWave::Storage::S3::File:0x00000006316a90>):
app/uploaders/image_uploader.rb:53:in `filename'
This is how I have filename defined in my uploader:
def filename
"image.#{model.image.file.extension}" if original_filename
end
How can i fix this? Thanks!
Try this:
def filename
"image.#{File.extname(original_filename).downcase}" if original_filename
end
精彩评论