views:

19

answers:

1

I'm using Rack middleware that accepts some configuration that I need to change at run time. So I need the instance of its class that's currently in memory. Is there a way to do obtain it?

A: 

I would follow an other way instead.

If you are using Rails 3, you can write the Rack middleware so that it accesses the shared application configuration available at Rails::Application.config. Otherwise, no matter which is your Rails version, you can use a configuration library (such as the simple_config gem) and keep the current configuration value in memory so that the Middleware can access it.

Last but not least, remember that Rack has a Rack::Config middleware that you can adapt to your needs.

Simone Carletti
Thanks for the suggestions. In this case I'm on Rails 2.3. Seems like I'd need to fork the middleware gem to use Rack::Config.
marko