Open lstanden opened 11 years ago
It appears the option which causes grief here is config.threadsafe!
This enables things like eager loading and disables automatic loading of classes. I can probably leave this off, although it would be more desirable to have it enabled.
It sounds like you might have isolated the problem. Can you give us a reproducible test case (e.g., in a gist)?
Yep, using config.threadsafe! enabled in my application is what's causing it.
I'm not sure how to easily put this into a test case, but all I did to replicate it was uncomment config.threadsafe! from the production config, then run RAILS_ENV=production rake suveyor FILE=surveys/blah.rb
I was able to reproduce this in Surveyor's testbed. Thanks for reporting it.
FWIW, it's unlikely that this particular issue will be fixed by us in the near future. So far our group is only using Surveyor in MRI+Passenger deployments, so this does not affect us. If you (or someone else) can provide a pull request, we'd be happy to review it.
I had the same issue. It is not a surveyor-specific problem. I was able to fix it by following http://stackoverflow.com/questions/9828841/production-rake-tasks-dont-recognize-my-models
Put in config/environments/production.rb
the following line after config.threadsafe!:
config.dependency_loading = true if $rails_rake_task
Sidenote: Rails 4.0 deprecates the use of config.threadsafe!
in favor of config.eager_load
.
The rake task currently fails in production (or in my case, staging, which uses the same config as production) because it is relying on the auto loading capabilities of rails. I believe the rake task needs the appropriate 'require' lines added to function in a production environment.