开发者

Problem in migrating a database to Heroku

开发者 https://www.devze.com 2023-03-25 15:24 出处:网络
When trying to migrate a database to Heroku, I get the following (Provided that I\'m using gem \'sqlite3\', \'1.3.3\':

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
skLib>'
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:R
ake>'
/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开发者_JS百科/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.


Rake aborted! Uninitialized constant Rake::DSL on Heroku

I have a blog post about this here. There are two ways to do this:

Only use the older version of rake:

Check out your current Rake versions with $ gem list. See which versions of rake you have and remove them all except for0.8.7. You can remove the gems withgem uninstall rake -v=0.9.1 or whatever version you need to remove.

Or just add a one liner to your rake file:

Unless you have to use the older version of Rake it is easier to add this linerequire 'rake/dsl_definition' to your Rails's app Rakefile.

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

精彩评论

暂无评论...
验证码 换一张
取 消