small medium large xlarge

23 May 2011, 03:54
Lexi Ross (1 post)

Hi, I’ve gotten through the book with no problems until page 80, when I get the following error after running the @rake db:migrate@ command: @rake aborted!@ @undefined method `task’ for #@

After searching on this forum for awhile, I tried switching to Rails 3.0.5 and starting over with depot (I was using 3.0.7 originally). Again, I followed along with the book exactly, but got the same error.

I tried to figure out which version of rake I’m using, but @rake -v@ returns this error:

@rake aborted!@ @undefined method `task’ for #@

(note different memory address than first error).

What could be going wrong here? I’m using Ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10], and I’m running Mac OS X 10.6.5. I would appreciate any help! I’ve been following the book’s instructions to the letter, so I don’t know what the problem could be. Thanks!

29 May 2011, 01:04
Takashi Fujiwara (1 post)

I’d also met same symptom with similar environment. However, just could have gotten through Task A1 with following additional comments on Rakefile under the depot directory.

require File.expand_path('../config/application', __FILE__)
require 'rake'

## Addtional config begin
module ::Depot ## <= Align to the name of application
  class Application
    include Rake::DSL

module ::RakeFileUtils
  extend Rake::FileUtilsExt
## Addtional config end


Hope this helps, Takashi

29 May 2011, 07:12
Trung Lê (10 posts)

Worry not, this is caused by rake 0.90 and fixed in RoR 3.0.8 which will be released on 1st June.

04 Jul 2011, 01:33
Foo Manchoo (1 post)

This problem still exists for some versions of some platforms, for example:

rake aborted! uninitialized constant Rake::DSL

First try editing Rakefile by inserting the following line above the require ‘rake’ line in the Rakefile:

require ‘rake/dsl_definition’

Save the Rakefile. Might need to rebuild your bundle from the depot directory’s command line:

bundle install

If that doesn’t work it usually can be fixed by reverting to rake gem 0.8.7 by using the following procedures:

In the depot directory enter this command to see what version of rake you have:

depot> gem list –local rake


rake (0.9.2) ### You’re probably seeing something like this

To uninstall the rake 0.9.2 gem (for example) use the following command:

depot> gem uninstall rake -v 0.9.2

Remove executables: rake

in addition to the gem? [Yn] n ### I said n for no Executables and scripts will remain installed.

Now install rake gem 0.8.7:

depot> gem install rake -v 0.8.7

Now see if it’s installed:

depot> gem list –local rake


rake (0.8.7)

Now go up one directory and repeat the process for Section 6.1 Iteration A1, this time with a new name for the app, for example:

work> rails new depot2

work> cd depot2

depot2> ls -p

The files and directories should display as shown in the book.

Generate the scaffold as shown in the Generating the Scaffold section.

Then run the rake command as shown in the Applying the Migration section:

depot2> rake db:migrate

This should work. Good luck!

You must be logged in to comment