The tire:import:all
Rake task throws an error: uninitialized constant Addres
#744
Comments
Thanks for the fix!, added and pushed. (See also #733) |
@karmi unfortunately that didn't fix it for me, I had to modify the rake task to depend on the environment and remove |
@felixbuenemann So |
@karmi The same happens if I enter the rails console and do a Maybe this could be fixed by trying to avoid double require like this? begin
klass = model_filename.camelize.constantize
rescue NameError
require(path) ? retry : raise
end If you think this is a viable solution I could make a PR. |
When loading environment berfor tire:import:all, it is possible that models are already loaded when tire tries to load them. This can cause redefinition of constants and all other kind of havoc. This fix first tries to constantize the models to see if they are already loaded before trying to require them. See issue karmi#744 for discussion.
When loading environment berfor tire:import:all, it is possible that models are already loaded when tire tries to load them. This can cause redefinition of constants and all other kind of havoc. This fix first tries to constantize the models to see if they are already loaded before trying to require them. See issue #744 for discussion. Closes #869
I create a model called Address.When I execute a rake task called tire:import:all,an error, uninitialized constant Addres, is throwed.
I notice some code in the source code file,the path of which is lib/tire/task.rb, should be modified to fix the above problem.
the former:
klass = model_filename.classify.constantize
updated to:
klass = model_filename.camelize.constantize
The text was updated successfully, but these errors were encountered: