rake aborted! undefined method `empty?' for nil:NilClass

Hi,

I'm getting the next errors, would anyone have any suggestions?

Thanks.

[~/rails/hip]# rake --trace db:migrate RAILS_ENV="production" (in /home/domain/rails/hip) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! undefined method `empty?' for nil:NilClass /usr/lib/ruby/1.8/erb.rb:469:in `scan' /usr/lib/ruby/1.8/erb.rb:525:in `compile' /usr/lib/ruby/1.8/erb.rb:692:in `initialize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/template_handl ers/erb.rb:51:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/template_handl ers/erb.rb:51:in `compile' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/template_handl er.rb:11:in `call'

From this part of the stack trace it looks likes it's happening when it preloads your view templates, maybe a template with something funny in it ?

Fred

Have you tried going back to the previous version (that worked) and then moving forward again?

Do you read rails documentation properly.

That was commented out and I removed the # to run the migrate. But that is working fine with my local environment.

I bet that if you set config.cache_classes = true in development.rb then you'll get this issue locally, which should make it easier to diagnose.

Fred

> I bet that if you set config.cache_classes = true in development.rb > then you'll get this issue locally, which should make it easier to > diagnose.

I won't ever bet anything with you Fred. I set that to false and now it works fine. I have been running migrations and made all sort of changes for a long time with that set to true and it has been ok. But now it really hit me.

That setting should absolutely be set to true or your production site will running a lot slower. I was merely suggesting that playing with that would allow you to reproduce the problem on your local machine. One of the things that setting does is make models, controllers, views etc. be loaded at start time (rather than on demand) and a side effect of that is that views or models you don't use will get loaded anyway, so an error in code that you never actually call or a view that you never display can still hit you

Fred