rack newb problem w/ 0.9.0

9 views
Skip to first unread message

Tom M

unread,
Jan 6, 2009, 5:33:02 PM1/6/09
to Rack Development
I am trying to upgrade a rack-based project to use 0.9, and am having
a problem w/ the new MIME_TYPE support. On start up of the app, I get
the following error:

/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/dependencies.rb:102:in `const_missing': uninitialized
constant Rack::File::MIME_TYPES (NameError)

I looked around in the specs, the readme, mime, and utils, and could
not find a definition of this constant. There were references in
Rack::Mime, but that's it.

On the one hand I suspect there is missing source, but OTOH I suspect
that my rack ignorance may be a better culprit. Any advice as to what
I am overlooking would be greatly appreciated.

Thanks!
Tom Macklin

Ryan Tomayko

unread,
Jan 6, 2009, 6:30:12 PM1/6/09
to rack-...@googlegroups.com
On 1/6/09 2:33 PM, Tom M wrote:
> I am trying to upgrade a rack-based project to use 0.9, and am having
> a problem w/ the new MIME_TYPE support. On start up of the app, I get
> the following error:

Hi Tom,

The MIME_TYPES constant got shuffled around in this release. You might
be able to work around it by adding the following somewhere in your app:

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

(not tested!)

Thanks,
Ryan

Christian Neukirchen

unread,
Jan 7, 2009, 3:54:01 AM1/7/09
to rack-...@googlegroups.com

Damn, you were right. ;-)

--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org

Tom M

unread,
Jan 7, 2009, 1:02:14 PM1/7/09
to Rack Development
NP... such is life when we go down the metaprogramming road...

On Jan 7, 3:54 am, "Christian Neukirchen" <chneukirc...@gmail.com>
wrote:
> Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org
Reply all
Reply to author
Forward
0 new messages