昨夜、私は自分のウェブアプリで多くの作業を行い、それが機能している状態で就寝しました。今日、目が覚めて別のコンピューターから Web ページにアクセスしようとしたところ、次の問題が発生しました。
Ruby (Rack) application could not be started
Error message:
undefined local variable or method `config' for main:Object
Exception class:
NameError
Backtrace:
# File Line Location
0 /var/www/myapp/config/initializers/setup_mail.rb 1
1 /var/lib/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
2 /var/lib/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
3 /var/lib/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 236 in `load_dependency'
4 /var/lib/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
5 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 588
6 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 587 in `each'
7 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 587
8 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 30 in `instance_exec'
9 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 30 in `run'
10 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 55 in `run_initializers'
11 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 54 in `each'
12 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 54 in `run_initializers'
13 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb 136 in `initialize!'
14 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb 30 in `send'
15 /var/lib/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb 30 in `method_missing'
16 /var/www/myapp/config/environment.rb 5
17 config.ru 3 in `require'
18 config.ru 3
19 /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb 51 in `instance_eval'
20 /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb 51 in `initialize'
21 config.ru 1 in `new'
22 config.ru 1
setup_mail.rbの内容
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => 'mydomain.com',
:openssl_verify_mode => 'none',
:tls => false,
:enable_starttls_auto => false
}
この問題のトラブルシューティング方法を教えてもらえますか? ファイルに変更を加えた場合、パッセンジャー、nginx、または Rails アプリを再起動する必要がありますか? エラー メッセージが難解すぎて、どこで問題を探すべきかわかりません。ご協力ありがとうございました!:)