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

http://gist.github.com/306481.js?file=config.ru">

2. application.rb

http://gist.github.com/306484.js?file=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?