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

**URL:** <https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903>\
**Category:** Rails\
**Created:** [May 8, 2006, 12:11pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903 "2006-05-08T12:11:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 12:11pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/1 "2006-05-08T12:11:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 12:30pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/2 "2006-05-08T12:30:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/3 "2006-05-08T12:48:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 12:58pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/4 "2006-05-08T12:58:38Z")

</div>

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](http://www.eachmapinject.com)

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 3:48pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/5 "2006-05-08T15:48:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [May 8, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/files-in-lib-folder-do-not-seem-to-update-even-in-dev-mode/59903/6 "2006-05-08T14:45:47Z")

</div>

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.
