在环境特定的配置文件中配置未定义

时间:2010-10-28 15:31:44

标签: ruby-on-rails ruby

当我在本地启动服务器时,我收到以下通知:

please set config.active_support.deprecation to :log at config/environments/development.rb

当我添加config / environments / development.rb

config.active_support.deprecation = :log 

我明白了:

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

我的环境: Rails 3.0.1 Ruby 1.8.7 Ubuntu 10.04

Development.rb文件

# Settings specified here will take precedence over those in config/environment.rb

# In the development environment your application's code is reloaded on
# every request.  This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.active_support.deprecation = :log
config.cache_classes = false

3 个答案:

答案 0 :(得分:11)

在您的development.rb中,它应该有一个看起来像这样的块:

YourApplicationName::Application.configure do
   config.active_support.deprecation = :log
   config.cache_classes = false
end

配置行必须放在该块内。

答案 1 :(得分:1)

确保在* .configure循环内添加其他config。*选项所在的行。

答案 2 :(得分:0)

试试这个

 rails s -e development