CSV MIME TYPE Bug in Rails 1.2.2

By Tim Kofol

Published: March 28th, 2007

For a couple of weeks I have been plagued by this annoying warning message in rails, "mime_type.rb:48: warning: already initialized constant CSV". Nothing worse than a constant ugly warning message. I would like to thank Progressive Data Solutions for ending my madness.

I had previously registered the CSV MIME type in my environment.rb, but starting in 1.2 this MIME type was added to the predifned MIME type list. But never made it out to the user due to a bug. The bug has since been fixed in the edge of rails and progressive solutions provides a nice fix for anybody using 1.2.2.

Just place the code below in your environment.rb. When the bug is finally fixed this statement will be safely ignored.

Mime::SET << Mime::CSV unless Mime::SET.include?(Mime::CSV)

Sorry, comments are closed for this article.