Rails won't reload my model

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!

Daniel Abrahamsson 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.