Fork me on GitHub

Back Home

Using Rack Middleware in Rails3

by Phil

I was just looking into including some Rack middleware in my Rails 3 app. One thing confused me slightly. There seems to be two ways that you can include middleware in you app:-

1. config.ru

2. application.rb

Note: I'm using the codehighlighter rack middleware for this example.

I'm not sure what is the recommended way, however, I think it seems best placed in the config.ru file (since this file is directly related to Rack). In the Rails edge documentation it says that you should use the config.middleware method in the "environment.rb" file... surely this couldn't be right?


blog comments powered by Disqus
© 2009 Phil McClure This site was developed using Compass, Blueprint and Ruby on Rails - Much thanks to these guys!