New Rails Plugin Mimetype_fu
mimetype_fu/ is a new plugin I just wrote. It’s simple and it can be really useful if you need to get the mime type of a file already on your server.
During one of my project, I add to migrate old assets from a legacy system to a new Rails app. The new app uses attachment fu and even though techno weenie did an amazing job, attachment_fu validation is based on the content type. A_fu gets the content type coming from the CGI query.
Unit test has a helper faking this process but in real life, if you use a Flash uploader (Flash doesn’t give you the proper mime type/content type) or if you want to migrate files, the attachment_fu validation won’t work for you.
The solution is simple: mimetype_fu/
mimetype_fu/ extends the File class and is really easy to use:
<code>File.mime_type?(@file)
</code>
Check it out https://code.google.com/p/mimetype-fu/
Expect a post showing how a ninja would use the mimetype_fu / attachment_fu combo :)