I've written my own middleware to provide an API endpoint to our application. The middleware loads classes that provide the API methods, and routes the request to the appropriate class/method. The classes are loaded dynamically through String#constantize
.
While running in development mode, the classes are automatically reloaded. However, if there is an uncaught exception – which is subsequently handled by the Failsafe middleware – the automatic reloading stops working. constantize
is still being called but it seems to return the old class.
It would appear there is something else that unloads classes, and an uncaught exception breaks it. What could this be?
Running Ruby 1.8.7, Rails 2.3.3 and Thin 1.2.2.