0

Hi I was following exactly the steps to create a demo application for Rubys on windows. but when I try to generate the tables using the scaffold command,

rails generate scaffold User name:string email:string

I got the following errors:

C:/Users/YoYo/Ruby_Projects/demo_app/config/environments/development.rb:1:in `<t
op (required)>': undefined method `configure' for #<DemoApp::Application:0x00000
00534bc00> (NoMethodError)
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/act
ive_support/dependencies.rb:229:in `require'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/act
ive_support/dependencies.rb:229:in `block in require'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/act
ive_support/dependencies.rb:214:in `load_dependency'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.5/lib/act
ive_support/dependencies.rb:229:in `require'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/en
gine.rb:591:in `block (2 levels) in <class:Engine>'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/en
gine.rb:590:in `each'
     from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/en
gine.rb:590:in `block in <class:Engine>'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:30:in `instance_exec'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:30:in `run'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:55:in `block in run_initializers'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'

    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in
each_strongly_connected_component'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in
each_strongly_connected_component_from'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connec
ted_component_from'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strong
ly_connected_component_from'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:44:in `each'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:44:in `tsort_each_child'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connec
ted_component_from'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strong
ly_connected_component'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connec
ted_component'
    from D:/Ruby200-x64/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/in
itializable.rb:54:in `run_initializers'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/ap
plication.rb:215:in `initialize!'
    from C:/Users/YoYo/Ruby_Projects/demo_app/config/environment.rb:5:in `<t
op (required)>'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/ap
plication.rb:189:in `require'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/ap
plication.rb:189:in `require_environment!'
    from D:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.5/lib/rails/co
mmands.rb:44:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Does anyone know how to solve?

Ji yong
  • 433
  • 2
  • 5
  • 12
  • The first line of your `demo_app/config/environments/development.rb` file should `DemoApp::Application.configure`.Please post your `development.rb` file. – Pavan May 19 '14 at 06:28

1 Answers1

4

So what you configured is a problem---

You can use-

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

rails-generate-scaffold-error

Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185
  • 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:42