I have a gem that provides some rack middleware, the only way I can get it to work is to place this in my application.rb
config.middleware.use "TBBC::Editor::Middleware"
How can I make it so that this middleware is automatically used when my gem is used in an apps Gemfile?
If you intend your gem to be used with Rails 3, you could provide a
Railtie. You can then automatically load it in case Rails is used.Assuming your gem’s name is
tbbc, place this inlib/tbbc/railtie.rb:In
lib/tbbc.rb:You can’t automatically add the middleware to generic Rack apps. For non-Rails applications, this will be something the user has to do.