Alex Wayne
2006-Aug-10 19:36 UTC
[Rails] Migrations suddenly broken: undefined method autoload_paths
I really need some help here because I am at a loss. I have been using migrations just fine now for a while and I suddenly started getting a very bizarre error when migrations are run: undefined method `autoload_paths='' for Dependencies:Module I have tried rolling back my application code, and rolling back the rails edge revision I am running but neither seem to help. I have installed the latest rails gems, even though I am running edge. I have even restarted our server. I just have no idea what to do next. It should be noted that everything works just fine on my windows development machine. Please someone help me figure out what is going on. -Alex [root@magneticworldinc mw]# rake db:migrate --trace (in /home/magneticworld) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! undefined method `autoload_paths='' for Dependencies:Module /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:131:in `set_autoload_paths'' /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:83:in `process'' /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:42:in `run'' /home/magneticworld/config/../config/environment.rb:10 -- Posted via http://www.ruby-forum.com/.
Adam
2006-Aug-14 19:08 UTC
[Rails] Re: Migrations suddenly broken: undefined method autoload_pa
Hi Alex, is the below your full stack trace? This happened to me, and when I ran rake with the trace, I noticed that it was using activerecord and activesupport from my /usr/local/lib folder and not my_proj/vendor/rails (which is edge rails). Once I removed my rails installation from /usr/local/lib it worked as it used the activerecord and activesupport libs from vendor/rails. Rails folks, what is the best way to totally remove a dependency on one''s /usr/local/lib binary and instead use the rails version in my_proj/vendor/lib. Thanks in Adv. Adam> > [root@magneticworldinc mw]# rake db:migrate --trace > (in /home/magneticworld) > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > rake aborted! > undefined method `autoload_paths='' for Dependencies:Module > /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:131:in > `set_autoload_paths'' > /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:83:in > `process'' > /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:42:in > `run'' > /home/magneticworld/config/../config/environment.rb:10-- Posted via http://www.ruby-forum.com/.
Alex Wayne
2006-Aug-14 19:28 UTC
[Rails] Re: Migrations suddenly broken: undefined method autoload_pa
Adam wrote:> > Hi Alex, is the below your full stack trace? > > This happened to me, and when I ran rake with the trace, I noticed that > it was using activerecord and activesupport from my /usr/local/lib > folder and not my_proj/vendor/rails (which is edge rails). > Once I removed my rails installation from /usr/local/lib it worked as it > used the activerecord and activesupport libs from vendor/rails. > > Rails folks, what is the best way to totally remove a dependency on > one''s /usr/local/lib binary and instead use the rails version in > my_proj/vendor/lib. > > Thanks in Adv. > AdamRemoving vendor/rails did allow me to migrate, I stumbled into that myself. But in order to do it I also have to comment out my map.resources calls or migrations crash when the rails is loading due to bad routes which are not yet supported in the gems. So it''s really big pain in the butt. There is one line in the trace that does look like it is loading the dependency module from the gems, and not vendor: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' I even tried uninstalling the rails gems and got "Could not find RubyGem activesupport (= 1.3.1)" so the gems must at least be there, even if they are out of date. So what exactly is happening here? here is the full trace: ========================================================rake aborted! undefined method `autoload_paths='' for Dependencies:Module /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:131:in `set_autoload_paths'' /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:83:in `process'' /home/magneticworld/config/../vendor/rails/railties/lib/initializer.rb:42:in `run'' /home/magneticworld/config/../config/environment.rb:10 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'' /home/magneticworld/config/../vendor/rails/railties/lib/tasks/misc.rake:3 -- Posted via http://www.ruby-forum.com/.
Jonathan Goldman
2006-Aug-14 21:26 UTC
[Rails] Migrations suddenly broken: undefined method autoload_paths
This is happening because of one of your custom rake tasks, assuming you have any. rails_rcov did it to me.
Adam
2006-Aug-14 21:47 UTC
[Rails] Re: Migrations suddenly broken: undefined method autoload_pa
wow... that was a bit hidden. If you have any rake tasks that have a require statement, make sure there are no leading or trailing spaces. If there are then you will see that error. obscure eh? ;) also check your plugins as many of them have their own tasks. Now I can sleep better at night ;) Time to open up a bug for this one. -- Posted via http://www.ruby-forum.com/.
Alex Wayne
2006-Aug-14 22:58 UTC
[Rails] Re: Migrations suddenly broken: undefined method autoload_pa
Adam wrote:> wow... that was a bit hidden. > > If you have any rake tasks that have a require statement, make sure > there are no leading or trailing spaces. If there are then you will see > that error. > > obscure eh? ;) > > also check your plugins as many of them have their own tasks. > > Now I can sleep better at night ;) > > Time to open up a bug for this one.Awesome! The problem appeared to be a plugin that suddenly became incompatible with edge rails. The rails_rcov plugin was crashing it. I couldnt find a require with spaces in it though. Thanks for the tip to check out my plugins. -Alex -- Posted via http://www.ruby-forum.com/.
Adam
2006-Aug-15 00:33 UTC
[Rails] Re: Migrations suddenly broken: undefined method autoload_pa
hey Alex I saw someone on IRC #rubyonrails had the same issue with that plugin. I haven''t used it, but it could also be that the code within the plugin is calling a module that has not been declared ''require''ed at the top of the file. Nicholas states that spaces are not allowed. I guess this is an example of the logic just becoming tighter and more ''in-line'' with ruby. A tad painful but it will probably be worth it. http://weblog.rubyonrails.org/2006/8/11/reloading-revamped/ Adam -- Posted via http://www.ruby-forum.com/.