Models not reloading in development in Rails (3.2.11) project

谁说胖子不能爱 提交于 2019-12-10 14:56:13

问题


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:

  1. You are not really running on developement environment
  2. You are changing a model within a namespace and didn't told rails to autoload the path
  3. You are changing a file that is included in your class, not your class directly (or any of the many variants for this)
  4. You are caching classes

Considerations:

  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!