# Autoloading not working when using rake task

**URL:** <https://www.ruby-forum.com/t/autoloading-not-working-when-using-rake-task/187334>\
**Category:** Rails\
**Created:** [April 21, 2010, 9:21pm UTC](https://www.ruby-forum.com/t/autoloading-not-working-when-using-rake-task/187334 "2010-04-21T21:21:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimkaspb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@dimkaspb](https://www.ruby-forum.com/u/dimkaspb)\
**Post date:** [April 21, 2010, 9:21pm UTC](https://www.ruby-forum.com/t/autoloading-not-working-when-using-rake-task/187334/1 "2010-04-21T21:21:30Z")

</div>

Hi,

I have a problem when I’m doing rake tasks. This behavior happens only  
on one machine, on another three ones all works fine (three is on  
ubuntu, problem one is under debian); totally identical environment (I  
guess).

I’m using translator gem, loading through config.gem in environment.rb  
file. Server and script/console - works fine, this happens only when  
I’m doing rake tasks (in both: development and production). I’ve  
researched that problem for a while (6 hours since I’ve started to get  
this problem, and research how to fix it), and now I’m at 90% sure  
that the problem is in the autoload method.

When I’m executing for example rake db:migrate I’m getting this  
exception:

stacktrace:

rake aborted!  
undefined method `translate' for class`ActionView::Base’  
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/  
active\_support/core\_ext/module/aliasing.rb:33:in `alias_method' /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/ active_support/core_ext/module/aliasing.rb:33:in`alias\_method\_chain’  
/opt/ruby/lib/ruby/gems/1.8/gems/translator-1.0.0/lib/translator.rb:  
288  
/opt/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' /opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/  
active\_support/dependencies.rb:156:in `require' /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/ active_support/dependencies.rb:521:in`new\_constants\_in’  
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/  
active\_support/dependencies.rb:156:in `require' /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/ gem_dependency.rb:208:in`load’  
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in  
`load_gems' /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in`each’  
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in  
`load_gems' /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in`process’  
/opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in  
`send' /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in`run’  
/home/deploy/somesite.com/releases/20100421143409/config/  
environment.rb:5  
/opt/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' /opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in`require’  
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/  
active\_support/dependencies.rb:156:in `require' /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/ active_support/dependencies.rb:521:in`new\_constants\_in’  
/opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/  
active\_support/dependencies.rb:156:in `require' /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4 /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in`call’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in  
`execute' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in`each’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in  
`execute' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in  
`invoke_prerequisites' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in`each’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in  
`invoke_prerequisites' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in  
`invoke_prerequisites' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in`each’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in  
`invoke_prerequisites' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in`invoke\_with\_call\_chain’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in  
`invoke' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in`invoke\_task’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in  
`top_level' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in`each’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in  
`top_level' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in`standard\_exception\_handling’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in  
`top_level' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in`run’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in  
`standard_exception_handling' /opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in`run’  
/opt/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31  
/opt/ruby/bin/rake:19:in `load’  
/opt/ruby/bin/rake:19

Please help me.  
Will be very appreciate!

---

<div class="post-metadata">

**Author:** ![dimkaspb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f19dbf/32.png) [@dimkaspb](https://www.ruby-forum.com/u/dimkaspb)\
**Post date:** [April 22, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/autoloading-not-working-when-using-rake-task/187334/2 "2010-04-22T16:22:38Z")

</div>

Anyone, where to dig?

On Apr 21, 8:17 pm, Dmitry P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
