0

I have been using ruby on rails fine no problem, now suddenly every time I run rake db:create I get the following errors:

C:\>cd xampp

C:\xampp>cd htdocs

C:\xampp\htdocs>cd what

C:\xampp\htdocs\what>rake db:create
rake aborted!
undefined method `task' for #<What::Application:0x20eb1e0>

(See full trace by running task with --trace)

C:\xampp\htdocs\what>

Any help please???

Here is all my cmd

   C:\xampp\htdocs\comeon>rake db:create --trace
rake aborted!
undefined method `task' for #<Comeon::Application:0x211fb30>
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:215:
in `initialize_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:139:
in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.7/lib/rails/application.rb:77:i
n `method_missing'
C:/xampp/htdocs/comeon/Rakefile:7:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `lo
ad'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `lo
ad_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:495:in `r
aw_load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:78:in `bl
ock in load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:129:in `s
tandard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:77:in `lo
ad_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:61:in `bl
ock in run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:129:in `s
tandard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/lib/rake/application.rb:59:in `ru
n'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'

C:/Ruby192/bin/rake:19:in `load'
C:/Ruby192/bin/rake:19:in `<main>'
5
  • please add the full trace....... Commented May 25, 2011 at 10:35
  • Yep, add the full trace and it'd be worth checking/reporting whether it happens with every rake task you try and call. Commented May 25, 2011 at 10:37
  • I cant understand why it was working fine no problem at all now i am getting these issue, i can still work on the old sites without issues its just the newly created ones, how can anything change does ruby/rails automatically download upgrades?????????? Commented May 25, 2011 at 11:32
  • 1
    possible duplicate of Undefined method 'task' using rake 0.9.0.beta.4 Commented May 29, 2011 at 4:45
  • It's definitely a repost of what Chris referenced. I had the same issue several days ago. Commented May 29, 2011 at 20:00

2 Answers 2

5

This will help you.

gem uninstall rake

gem install rake -v 0.8.7

If Still the problem exists, uninstall rake and install using

gem uninstall rake
gem install rake

for more info

Undefined method 'task' using Rake 0.9.0

Sign up to request clarification or add additional context in comments.

Comments

1

I was having the same problem, found a post by Jim Weirich in git hub that solved my problem

https://github.com/jimweirich/rake/issues/33#issuecomment-1213705

Two issues here: (1) dimitko's issue is that the built in rake command is being mixed with the new gem's library files. Arranging your $PATH environment list so that the gem version of rake has precendence over the built-in version should fix that. If you are using bundler, you might also want to try 'bundle exec rake'.

The second issue (mjansen401 and r00k above) is that the new version of rake does not put its DSL commands (task, file, desc, import, etc) in the root of the Object namespace anymore (placing them in Object meant every object has a task command, not very nice . The DSL commands are available by mixing in the Rake::DSL module into any module needing the commands.

Until rails is updated to work with Rake 0.9.x, put the following in your project Rakefile before the call to Application.load_tasks:

class Rails::Application
  include Rake::DSL if defined?(Rake::DSL)
end

Let me know if these work for you.

Hope it helps

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.