Skip to content

Instantly share code, notes, and snippets.

@simonrentzke
Created March 25, 2010 10:54
Show Gist options
  • Save simonrentzke/343418 to your computer and use it in GitHub Desktop.
Save simonrentzke/343418 to your computer and use it in GitHub Desktop.
content types
def set_content
case self.content_type
when "video/mpeg", "video/quicktime", "video/x-msvideo", 'video/x-ms-wmv', 'video/mp4', 'video/avi'
self.content = VIDEO
when 'image/gif', 'image/jpeg', 'image/png', "image/pjpeg", "image/x-png"
self.content = IMAGE
when 'audio/wav', 'audio/x-wav', 'audio/x-ms-wma', 'audio/mpeg', 'audio/x-m4a', 'audio/m4a'
self.content = AUDIO
when "application/msword", 'application/pdf', 'application/rtf', 'text/plain', 'text/rtf'
self.content = DOCUMENT
else
self.content = 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment