0

When I did rake routes in the DOS prompt (windows7) inside my application 'Ruby_on_Rails', it has shown the following:

(in D:/Ruby_on_Rails)
**rake aborted!**
uninitialized constant Rake::DSL
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<clas
s:TaskLib>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<modu
le:Rake>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top
(required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `requ
ire'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top
 (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.r
ake:2:in `require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/testing.r
ake:2:in `<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.r
b:12:in `load'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/test_unit/railtie.r
b:12:in `block in <class:TestUnitRailtie>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `
instance_exec'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `
block in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `
each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `
load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in `b
lock in load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railtie
s.rb:8:in `each'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application/railtie
s.rb:8:in `all'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:423:in `l
oad_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:145:
in `load_tasks'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurabl
e.rb:30:in `method_missing'
D:/Ruby_on_Rails/Rakefile:7:in `<top (required)>'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
C:/Ruby192/bin/rake:31:in `<main>'

What is this?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Unni
  • 165
  • 3
  • 10
  • You've obviously got a bad environment. Can you give more details on what you have installed and how you installed it? Are you sure you are running this command from the right directory? – Marc Talbot Feb 03 '12 at 04:41
  • Hi friend this link will help you to resolve the problem. http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl [1]: http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl – Soundar Rathinasamy Feb 03 '12 at 04:47
  • For Rails 3 : `Rails.application.routes.routes.to_a` (see [my original answer](http://stackoverflow.com/a/10576105/407213)) – Dorian May 13 '12 at 23:48

2 Answers2

1

Run following command

bundle update rake

Then check the version of rake by

bundle show rake

Add following to Rakefile.

require 'rake/dsl_definition' 

Check above steps.

Thanks.

Shamith c
  • 3,719
  • 3
  • 25
  • 33
1

Run:

bundle exec rake routes

Geo
  • 93,257
  • 117
  • 344
  • 520