16 June 2008

Banging my head with some rake error messages

It's the end of a long day. The perfect timing to waste time on trivial issues ... I completly agree with John Nunemaker that http://railstips.org/2008/6/10/programmers-should-give-up-more-often

This one took 30 minutes instead of 2 minutes if my brain had been at 100% !

rake -T --trace
(in /home/jeanmichel/ruby/projects/myproject/myproject1.0)
rake aborted!
uninitialized constant ActionMailer
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2237:in `const_missing'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/app/models/newsletter_mailer.rb:1
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/lib/mailer/newsletters_sender.rb:1
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/lib/tasks/mailing.rake:1
/home/jeanmichel/ruby/projects/myproject/myproject1.0/vendor/rails/railties/lib/tasks/rails.rb:7:in `load'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/vendor/rails/railties/lib/tasks/rails.rb:7
/home/jeanmichel/ruby/projects/myproject/myproject1.0/vendor/rails/railties/lib/tasks/rails.rb:7:in `each'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/vendor/rails/railties/lib/tasks/rails.rb:7
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/home/jeanmichel/ruby/projects/myproject/myproject1.0/Rakefile:10
/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:2149:in `load'

/usr/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19



This was because my rake task requires a lib/newsletters_mailer.rb file which was had a
require ''newsletter_mailer

importing a file app/models/newsletter_mailer.rb (typical class NewsletterMailer < ActionMailer::Base)

Don't ask me why I had this 'require' in place!!! Rails automatically imports models with all its magic.

No comments: