# Reloading modules

**URL:** <https://www.ruby-forum.com/t/reloading-modules/63276>\
**Category:** Rails\
**Created:** [June 13, 2006, 7:48pm UTC](https://www.ruby-forum.com/t/reloading-modules/63276 "2006-06-13T19:48:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robkuz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/34f0e0/32.png) [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Post date:** [June 13, 2006, 7:48pm UTC](https://www.ruby-forum.com/t/reloading-modules/63276/1 "2006-06-13T19:48:31Z")

</div>

hi,

can anybody tell me how i can reload modules automatically  
that are living in my …/lib directory?

for the moment i need to shut down rails and restart  
to see any changes.

thanks

ciao robertj

---

<div class="post-metadata">

**Author:** ![robkuz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/34f0e0/32.png) [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Post date:** [June 13, 2006, 8:13pm UTC](https://www.ruby-forum.com/t/reloading-modules/63276/2 "2006-06-13T20:13:56Z")

</div>

robert kuzelj wrote:

> hi,
> 
> can anybody tell me how i can reload modules automatically  
> that are living in my …/lib directory?
> 
> for the moment i need to shut down rails and restart  
> to see any changes.
> 
> thanks
> 
> ciao robertj

For classes you can put an “include Reloadable” in them, but sadly that  
does not work for modules.

You either need to restart the server, or explicitly load the files with  
the modules in them with the load statement. When testing a module via  
the console, I often have a command like:

load ‘lib/some\_lib.rb’; SomeLib.some\_method

This reloads the library, and does something with it an an easily  
repeatable line.

You may be able to add a before\_filter that test to see if you are in  
development mode, and then if you are, explicity does a ‘load’ on  
modules.
