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

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

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 

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

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

配置行必须放在该块内。

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

试试这个

  rails s -e development