# Trying to understand file loading, dependencies, etc. in rails

**URL:** <https://www.ruby-forum.com/t/trying-to-understand-file-loading-dependencies-etc-in-rails/154322>\
**Category:** Rails\
**Created:** [November 27, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/trying-to-understand-file-loading-dependencies-etc-in-rails/154322 "2008-11-27T18:09:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 27, 2008, 6:09pm UTC](https://www.ruby-forum.com/t/trying-to-understand-file-loading-dependencies-etc-in-rails/154322/1 "2008-11-27T18:09:45Z")

</div>

I’m developing on Windows, using InstantRails and i’ve run into a  
problem.

My development workflow, till now, has been as follows:

1. start the server: ruby script/server --debug
2. run my application by invoking a controller from the browser -  
observe behaviour
3. edit source file to fix bug/change behaviour
4. save source file
5. goto #2

This has worked really well for me, until recently.

The bulk of the code that I am working on is in a file (‘foo.rb’) that  
is in the model directory but that is not associated with a specific  
model. It declares a certain constant that I would like to be able to  
access from my controller. So - in my controller, I have required  
foo.rb (require “foo.rb”).

This seems to have broken my nice comfortable workflow. Now - when I  
make changes in foo.rb and save foo.rb, the changes are not picked up  
and have no effect on program execution. I need restart the server in  
order to pick up the changes.

I assume that somehow, requiring foo.rb in my controller prevents it  
from being reloaded automatically as it had been previously. Is there  
a way to force foo.rb to be reloaded after a change? Other suggestions  
for how to get aorund this?

Many thanks.  
Yoram

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 27, 2008, 6:23pm UTC](https://www.ruby-forum.com/t/trying-to-understand-file-loading-dependencies-etc-in-rails/154322/2 "2008-11-27T18:23:50Z")

</div>

On Nov 27, 5:08 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> This has worked really well for me, until recently.
> 
> The bulk of the code that I am working on is in a file (‘foo.rb’) that  
> is in the model directory but that is not associated with a specific  
> model. It declares a certain constant that I would like to be able to  
> access from my controller. So - in my controller, I have required  
> foo.rb (require “foo.rb”).

See what I wrote on this:

> **[Required or Not ? - Space Vatican](https://www.spacevatican.org/2008/9/28/required-or-not/)**
>
> One of Rails’ slightly gnarly areas is all the magic that goes into enabling the automatic reloading of source in development mode\[1\]. …

Fred
