I'm following Michael Hartl's Ruby on Rails Tutorial using nitrous.io. Right now I'm trying to make use of the scaffold command and it's returning a NoMethodError. I'm very new to coding so I'm not sure of the cause of the error but here's exactly what's happening:

~/workspace/rails_projects/demo_app(master)$ rails generate scaffold User name:string email:string
/home/action/workspace/rails_projects/demo_app/config/environments/development.rb:1:in `<top (required)>': undefined method `configure' for #<DemoAppp::Application:0x007fa3572a63e8> (NoMethodError)
        from /home/action/.gem/ruby/2.1.1/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
        from /home/action/.gem/ruby/2.1.1/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require'
        from /home/action/.gem/ruby/2.1.1/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency'
        from /home/action/.gem/ruby/2.1.1/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/engine.rb:590:in `each'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/engine.rb:590:in `block in <class:Engine>'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:30:in `run'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:44:in `each'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:44:in `tsort_each_child'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:411:in `call'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `call'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
        from /home/action/.parts/packages/ruby2.1/2.1.1/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/application.rb:215:in `initialize!'
        from /home/action/workspace/rails_projects/demo_app/config/environment.rb:5:in `<top (required)>'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/application.rb:189:in `require'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/application.rb:189:in `require_environment!'
        from /home/action/.gem/ruby/2.1.1/gems/railties-4.0.5/lib/rails/commands.rb:44:in `<top (required)>'
        from bin/rails:8:in `require'
        from bin/rails:8:in `<main>'

To me it seems like for some reason the path for development.rb is not the right one, but I'm just guessing.

有帮助吗?

解决方案

This can result from namespacing issues in your environment. Your app is called DemoAppp (note the three "p"s), so ensure that your naming convention adheres to the following:

# app/config/initializers/development.rb
DemoAppp::Application.configure do

Alternatively, if it's possible that DemoAppp is a misspelling, you may want to replace DemoAppp with DemoApp with two "p"s.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top