Rake error: uninitialized constant ActiveRecord


#1

Hallo – I can’t run any rake tasks all of a sudden in my project.
It was fine when I put it down the other day!
The output I get when I try to run a rake task is:

W:\holly> rake in W:/holly) rake aborted! uninitialized constant ActiveRecord W:/holly/rakefile:10 (See full trace by running task with --trace)

Can anyone shed any light on this?
I’m hamstrung w/out rake!
Cheers,
Doug.


#2

On Wed, 20 Jun 2007, doug livesey wrote:

Hallo – I can’t run any rake tasks all of a sudden in my project.
It was fine when I put it down the other day!
The output I get when I try to run a rake task is:
[…]
rake aborted!
uninitialized constant ActiveRecord
W:/holly/rakefile:10
(See full trace by running task with --trace)

Well, you could show the first 10 lines of your Rakefile. But there
should be a
require ‘activerecord’
in there somewhere, or a require that calls a require to pull in
ActiveRecord.

Can anyone shed any light on this?
I’m hamstrung w/out rake!
Cheers,
Doug.

    Hugh

#3

Hi – sorry, should have said – it’s a standard RoR rakefile.
The contents are:

# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(FILE), ‘config’, ‘boot’))

require ‘rake’
require ‘rake/testtask’
require ‘rake/rdoctask’

require ‘tasks/rails’

Line 10 is the last line, & it calls all Rails framework stuff, so I
don’t think it’s anything I’ve done.

Cheers,
Doug.


#4

Got it!
It was one of my custom rake tasks!
The damn’ thing had never worked properly, & I’d clean forgotten about
it – it was requiring a non-existant file & silently exiting, so I just
zapped it, & all’s well w/ the world.
The amount of time I could’ve saved by remembering to run “rake --trace”
in the first place…
Cheers for your input.
Doug.