Ruby Sinatra: uninitialized constant Rack::File::MIME_TYPES

Original: rack newb problem w/ 0.9.0

When tried to run a sinatra based application, I received an error message:

./sinatra/lib/sinatra.rb:1156:in `mime': uninitialized constant Rack::File::MIME_TYPES (NameError)

According to Ryan Tomayko "...MIME_TYPES constant got shuffled around in this release (rack release)...".

The solution (temporary) is to define Rack::File::MIME_TYPES by yourself before requiring sinatra:

require 'rack/file'
class Rack::File
   MIME_TYPES = Hash.new { |hash, key|
   Rack::Mime::MIME_TYPES[".#{key}"] }
end
require 'sinatra'
...