Files in LIB folder do not seem to update even in DEV mode!

Hi

When i change my classes in the LIB folder they are not updating on the
server. My server is in development mode. Any ideas why?

Any help is appreciated
Thanks,
Chris

You need to include Reloadable in any classes that you want reloaded
with each request. Some classes, like ActiveRecord, include this
already.

class MyClass
include Reloadable
end

-Jonny.

Thanks Jonny.

It seems a strange to have to do. Surely in development mode it should
reload all your classes on each request? is this not the point of
development mode?

So, i have to inlude “include Reloadable” in the classes i want to
reload while i am developing. And then when i go into production mode i
will remove the code. Seems plain wrong.

Chris R. wrote:

Thanks Jonny.

It seems a strange to have to do. Surely in development mode it should
reload all your classes on each request? is this not the point of
development mode?

So, i have to inlude “include Reloadable” in the classes i want to
reload while i am developing. And then when i go into production mode i
will remove the code. Seems plain wrong.

Model files can only reload becasue they inherit from
ActiveRecord::Base, to Rails knows about them, but it doesn’t know about
files that don’t inherit from that.

J`ey
http://www.eachmapinject.com

Imagine a file in your lib folder that had this in it:

class Scary
File.delete “/something/important.cfg”
end

…or

class Spam
MyMailModel.deliver_spam
end

You’d want to be pretty sure you wanted to reload those automatically
before letting it happen.

I don’t know enough about it to tell you why Rails doesn’t simply
remove everything and start again, but I’m sure there are reasons.

You don’t need to remove the ‘include Reloadable’ line when in
production. The code which reloads the classes simply isn’t called
when in production. You can remove it if you want, but you don’t have
to.

-Jonny.