Problem in migrating a database to Heroku

When trying to migrate a database to `Heroku`, I get the following (Provided that I'm using `gem 'sqlite3', '1.3.3'`:

    $ heroku rake db:migrate     (in /app)     rake aborted!     uninitialized constant Rake::DSL     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'     /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:Ta     >'     /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:R     >'     /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (req     uired)>'     /app/.bundle/gems/ruby/1.9.1/gems/rdoc-3.9.1/lib/rdoc/task.rb:37:in `require'     /app/.bundle/gems/ruby/1.9.1/gems/rdoc-3.9.1/lib/rdoc/task.rb:37:in `<top (requi     red)>'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.r     ake:2:in `require'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.r     ake:2:in `<top (required)>'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `load'

    /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in `block      in <top (required)>'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `each'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in `<top (     required)>'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in      `require'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in      `initialize_tasks'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:139:in      `load_tasks'     /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in     `method_missing'     /app/Rakefile:7:in `<top (required)>'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'     /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run'     /usr/ruby1.9.2/bin/rake:31:in `<main>'

How can I solve this issue?

Thanks.

There is plenty of information about that error online.

Google "uninitialized constant Rake::DSL"

As an aside having a handle like "SW Engineer" and failing to do something that simple will open you up to lots of grief.

Unless SW stands for "Soapy Water" in which case you should clarify things.

Put this in your Rakefile above require ‘rake’

require 'rake/dsl_definition

Check this: http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl

All problems are solved with Rake gem 0.9.2… I followed these steps:

  • I installed gem install rake -v=0.9.2 (I had the 0.9.1 gem)

  • removed the 0.9.1 with gem uninstall rake -v=0.9.1

  • updated with bundle update

  • then the db:migrate showed a warning, WARNING: Global access to Rake DSL methods is deprecated. Please....

    It was solved by adding the following to the Rake file.

    module ::YourApplicationName  
      class Application
    
          include Rake::DSL
      end
    end
    

If the above code not working means u can specify the rake gem version in your gem file and run command, bundle install from command prompt.

may be it will solve the issue .