# Rails won't reload my model

**URL:** <https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361>\
**Category:** Rails\
**Created:** [June 13, 2008, 8:19am UTC](https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361 "2008-06-13T08:19:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dazuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d6d6ee/32.png) [@dazuma](https://www.ruby-forum.com/u/dazuma)\
**Post date:** [June 13, 2008, 8:19am UTC](https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361/1 "2008-06-13T08:19:23Z")

</div>

I have a class method in one of my models that I call from one of my  
controller, like this:

1. def handle\_some\_uploaded\_file
2. messages = MyModel.load\_something\_from\_file(params[:data\_file])
3. …
4. end

The thing is that when I change MyModel (and restart the server), the  
changes aren’t reflected. I can change MyModel.load\_something\_from\_file  
to raise an error, and still Rails won’t notice. Instead it is running  
the code from before the model was changed!

First I thought this had to do with some obscure browser caching, but  
clearing the caches didn’t help. I also tried adding a “hello”-method to  
MyModel and call it from the controller, but Rails just insisted that  
there was no such method. I even removed the whole model once, but Rails  
still didn’t notice!

My only suggestion is that the webserver (I have tried with both Mongrel  
and WEBrick) is perfoming some very strange caching on this file  
specifically and won’t let me update it.

I haven’t had this problem with any of my other models or controllers.  
What can be wrong?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![dazuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d6d6ee/32.png) [@dazuma](https://www.ruby-forum.com/u/dazuma)\
**Post date:** [June 13, 2008, 12:58pm UTC](https://www.ruby-forum.com/t/rails-wont-reload-my-model/140361/2 "2008-06-13T12:58:14Z")

</div>

Daniel A. wrote:

> The thing is that when I change MyModel (and restart the server), the  
> changes aren’t reflected. I can change MyModel.load\_something\_from\_file  
> to raise an error, and still Rails won’t notice. Instead it is running  
> the code from before the model was changed!

Can you verify that the application is actually offline when you kill  
the server?  
There is no such thing as file-based model caching.

–  
Roderick van Domburg

> **[De domeinnaam Nedforce.nl is te koop.](http://www.nedforce.nl)**
>
> Deze mooie domeinnaam kan al over een paar minuten van jou zijn. Betalen gaat eenvoudig en vertrouwd via iDEAL. Direct na de betaling ontvang je de verhuiscode per e-mail en kun je aan de slag.
