rails generate scaffold error

孤街浪徒 提交于 2019-12-02 23:14:31

问题


I'm working on the RailsTutorial.org book and I keep hitting an error. When I run

rails generate scaffold User name:string email:string

I'm getting the following error:

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

I'm running Ruby 2.0.0 and Rails 4.0.4. Here is the contents of 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 

Please let me know if you need to see any more of the code snippets. Any help would be greatly appreciated.


回答1:


try:

   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


来源:https://stackoverflow.com/questions/23388205/rails-generate-scaffold-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!