rails生成脚手架错误

时间:2014-04-30 12:32:51

标签: ruby-on-rails ruby scaffold

我正在处理RailsTutorial.org上的书并且我一直在遇到错误。我跑的时候

rails generate scaffold User name:string email:string

我收到以下错误:

/Users/Cody/Development/rails_projects/demo_app/config/environments/development.rb:1:in `<top (required)>': undefined method `configure' for #<DemoApp::Application:0x007fdcea90ae10> (NoMethodError)

我正在运行Ruby 2.0.0和Rails 4.0.4。以下是enviroments / development.rb

的内容
Rails.application.configure do
config.cache_classes = false
config.consider_all_requests_local       = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.assets.debug = true
config.assets.raise_runtime_errors = true
end 

如果您需要查看更多代码段,请与我们联系。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

尝试:

   DemoApp::Application.configure do
    config.cache_classes = false
    config.consider_all_requests_local       = true
    config.action_controller.perform_caching = false
    config.action_mailer.raise_delivery_errors = false
    config.active_support.deprecation = :log
    config.active_record.migration_error = :page_load
    config.assets.debug = true
    config.assets.raise_runtime_errors = true
   end