问题
I've searched fairly extensively for any advice and have yet to find it so, here goes:
My Rails project fails to automatically reload models in development. Reloading them currently requires a full server restart.
Previous instances of this issue have been related to non-activerecord files placed in the models directory, though this is not the case for me.
config.cache_classes is properly set to false in my development config file. Views and controllers reload without issue.
All of my rails components are version 3.2.11. I have tried disabling all of my development-specific gems to no avail. This is obviously not a productivity stopper, but it is quite an annoyance. Any help appreciated and I am happy to provide more information if it would help, though I am not using any exotic gems.
Thanks!
回答1:
Some possibilities:
- You are not really running on developement environment
- You are changing a model within a namespace and didn't told rails to autoload the path
- You are changing a file that is included in your class, not your class directly (or any of the many variants for this)
- You are caching classes
Considerations:
- Things might change according to the webserver you are using
回答2:
How do you know it's not reloading?
I ask my question because I was having the exact same issue when I was trying to insert a debugger into what I thought was a piece of code that was being executed. I assumed the model wasn't being reloaded since it was not hitting the debugger but it was actually a call back that was redirecting me around the code with the debugger line in it.
So, it might be something other than your models not being reloaded.
来源:https://stackoverflow.com/questions/16946338/models-not-reloading-in-development-in-rails-3-2-11-project