Production Rake Tasks Don't Recognize My Models

十年热恋 提交于 2019-11-30 20:10:48

By default threadsafe set dependency_loading = false
If you want to enable threadsafe in your application and access to your models in your task, you'll need to load it.

# Enable threaded mode
config.threadsafe!
config.dependency_loading = true if $rails_rake_task


Ref.: http://nowhereman.github.com/how-to/rails_thread_safe/

Hope this help!

Trespassers W

I had threadsafe! = true configured in my production environment at config/environments/production.rb

Disabling this solves the problem.

The answer found here: rake aborted! uninitialized constant Object::Country, why can't see model? gives some more explanation and other workaround options (particularly the last link)

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