-1

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.

user2212003
  • 35
  • 1
  • 9

1 Answers1

2

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
Florian Widtmann
  • 524
  • 4
  • 15
  • For people wondering why this problem is occurring, you probably ran `rails new ...` with a version of Rails higher or equal to 4.1.x, and then told the app to use an older version of Rails through the Gemfile. Rails 4.1.x+ uses `Rails.application.configure` while older versions of Rails 4 use `AppName::Application.configure`. It is possible to specify which version of rails you want during installation like so: `rails _4.x.x_ new appname`. – Gabriel S. Jul 11 '14 at 15:43