Chromed Shark

My various ramblings about programming

Rack Middleware in Rails 2

If you have a rack middleware packaged as a gem that you would like to use in your rails app, add these lines to your environment.rb file:

1
2
config.gem 'rack-amf', :lib => 'rack/amf', :source => "http://gemcutter.org/"
config.middleware.use 'Rack::AMF', :url => '/amf'

Make sure you put the middleware name in a string, or rails initialization will fail because the gem hasn’t loaded yet.