Forum: Ruby on Rails trying to understand file loading, dependencies, etc. in rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9d12e24c0a3aebe28b58682d517acdfb?d=identicon&s=25 ybernet@msn.com (Guest)
on 2008-11-27 18:09
(Received via mailing list)
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-27 18:23
(Received via mailing list)
On Nov 27, 5:08 pm, "yber...@msn.com" <yber...@msn.com> 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:
http://www.spacevatican.org/2008/9/28/required-or-not

Fred
This topic is locked and can not be replied to.