When attaching a file in a Rails app via Paperclip, you may get an error like:
Validation failed: Image has an extension that does not match its contents
To resolve this, create the file config/initilizers/paperclip.rb and then restart your server.
#config/initilizers/paperclip.rb
require 'paperclip/media_type_spoof_detector'
module Paperclip
class MediaTypeSpoofDetector
def spoofed?
false
end
end
end