【发布时间】:2025-12-01 07:45:01
【问题描述】:
您好,我完全按照在 Windows 上为 Rubys 创建演示应用程序的步骤进行操作。但是当我尝试使用脚手架命令生成表时,
rails generate scaffold User name:string email:string
我收到以下错误:
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>'
有人知道怎么解决吗?
【问题讨论】:
-
demo_app/config/environments/development.rb文件的第一行应为DemoApp::Application.configure。请发布您的development.rb文件。