问题描述:

error using Rails 3.1 and Heroku, below is the error I get when I try heroku rake db:migrate, any help on this is highly appreciated.

Arugil1 git:(master) heroku rake db:migrate

rake aborted!

undefined local variable or method `config' for main:Object

Tasks: TOP => db:migrate => environmen

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

Arugil1 git:(master) heroku rake db:migrate --trace

** Invoke db:migrate (first_time)

** Invoke environment (first_time)

** Execute environment

rake aborted!

undefined local variable or method `config' for main:Object

/app/config/environment.rb:3:in `<top (required)>'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport- 3.1.0.rc6/lib/active_support/dependencies.rb:237:in `require'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:237:in `block in require'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:223:in `block in load_dependency'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:636:in `new_constants_in'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:223:in `load_dependency'

/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:237:in `require'

/app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.0.rc6/lib/rails/application.rb:78:in `require_environment!'

/app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.0.rc6/lib/rails/application.rb:189:in `block (2 levels) in initialize_tasks'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'

/usr/ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'

/usr/ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'

/app/.bundle/gems/ruby/1.9.1/bin/rake:19:in `load'

/app/.bundle/gems/ruby/1.9.1/bin/rake:19:in `<main>'

Tasks: TOP => db:migrate => environment

Also below is the Gemfile content:

 Arugil1 git:(master) more Gemfile | grep racer

gem 'therubyracer'

gem 'therubyracer-heroku', '0.8.1.pre3'

gem 'therubyracer-heroku', '0.8.1.pre3'

gem 'therubyracer'

gem 'therubyracer-heroku', '0.8.1.pre3'

gem 'therubyracer'

And the environmnet.rb output:

 Arugil1 git:(master) more config/environment.rb

# Load the rails application

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

# Initialize the rails application

DMr::Application.initialize!`

网友答案:

Not a direct answer, but perhaps this thread might be of help

config undefined in environment specific configuration files

相关阅读:
Top