Module: MimemagicActionPackUploadedFile::UploadedFileWithMimemagic

Defined in:
lib/mimemagic_action_pack_uploaded_file/uploaded_file_with_mimemagic.rb

Overview

Detect content_type from magic byte instead of request parameters.

Constant Summary collapse

UNKNOWN_CONTENT_TYPE =
'unknown/unknown'.freeze

Instance Method Summary collapse

Instance Method Details

#initializeObject



8
9
10
11
# File 'lib/mimemagic_action_pack_uploaded_file/uploaded_file_with_mimemagic.rb', line 8

def initialize(*)
  super
  @content_type = MimeMagic.by_magic(@tempfile).try(:type) || UNKNOWN_CONTENT_TYPE
end