# How to reload classes on each request?

**URL:** <https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465>\
**Category:** Rails\
**Created:** [February 22, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465 "2007-02-22T14:43:33Z")\
**Posts on this page:** 4\
**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:** [February 22, 2007, 2:43pm UTC](https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465/1 "2007-02-22T14:43:33Z")

</div>

Hi guys.

I am playing with Rails, for two days, it’s great, but I have one very  
annoying problem.

Now I’m restaring web server after each code change, because otherwise  
server use old classes.  
Rails doesn’t refresh models, controllers, helpers, but refreshes  
RHTMLs.

I’m running in development environment, with standard config:  
config.cache\_classes = false  
config.whiny\_nils = true  
config.breakpoint\_server = true  
config.action\_controller.consider\_all\_requests\_local = true  
config.action\_controller.perform\_caching = false  
config.action\_view.cache\_template\_extensions = false  
config.action\_view.debug\_rjs = true  
config.action\_mailer.raise\_delivery\_errors = false

I tried webrick and mongrel, tried run it from radrails, nothing  
helped.  
I use ruby 1.8.5, rails 1.2.2, mongrel 1.0.1, on Windows Vista.

I somebody knows what should I do, please help me.

---

<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:** [February 22, 2007, 2:52pm UTC](https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465/2 "2007-02-22T14:52:35Z")

</div>

Odd, because using WEbrick (ruby script/server) does that exactly. I  
guess  
try reinstalling Rails?

Jason

---

<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:** [February 22, 2007, 5:29pm UTC](https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465/3 "2007-02-22T17:29:14Z")

</div>

I’ m absolutely sure that I’m running dev environment.

Really now I install InstantRails and point InstantRails version of  
Mongrel, and my separately  
installed version of Mongrel to the same app dir, InstantRails version  
refreshes files, but my mongrel and webrick do not.

I absolutely don’t understand where is the difference between them.  
Server versions are identical, env = dev - 100%.

---

<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:** [February 22, 2007, 5:18pm UTC](https://www.ruby-forum.com/t/how-to-reload-classes-on-each-request/86465/4 "2007-02-22T17:18:39Z")

</div>

Jason R. wrote:

> Odd, because using WEbrick (ruby script/server) does that exactly. I  
> guess  
> try reinstalling Rails?
> 
> Jason

Make sure your environment settings (in config/environment.rb if I  
remember correctly) is set to development and not production.

On development everything is reloaded on each request which means it is  
slower but uses the very latest code.
