reload external lib

In development mode rails reloads all the controllers and models each time they are requested. Is it possible to make rails reload any other files, for example ones that I placed under the lib folder and require in environment.rb?

In development mode rails reloads all the controllers and models each time they are requested. Is it possible to make rails reload any other files, for example ones that I placed under the lib folder and require in environment.rb?

If anybody has a solution to this I too would be interested in knowing. Is the reload list configurable in any way at all?

If not where is the list so I can change it manually?

You need to include Reloadable in the classes you want reloaded.

class Fred   include Reloadable end

This will make Fred and all its subclasses reload on each request. There's also include Reloadable::Subclasses.

class Base   include Reloadable::Subclasses end

This makes subclasses of Base reload on each request, but not Base itself. (Used, for instance, by ActiveRecord::Base.)

You can also *prevent* a class from being reloaded by making #reloadable? return false.

class MyThingy < Base   def self.reloadable?     false   end end

HTH.

In Rails 1.1.6 you can put "include Reloadable" into your lib classes to make them reload (only works for classes, not modules). In Rails 1.2 "include Reloadable" has been deprecated. My understanding is that class reloading has been improved making the explicit Reloadable declaration unnecessary.

Aaron