0

我正在关注http://ruby.railstutorial.org/上的教程,现在我无法启动服务器。在我的 gemfile 中,我使用的是 ruby​​ 2.0.0 和 rails 4.0.0.rc1 - 然后我尝试改回 ruby​​ 1.9.3 和 rails 3.2.13 - 仍然无法正常工作

这是终端告诉我的:

/config/environments/development.rb:1:in `<top (required)>': uninitialized constant FourTest (NameError)
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:591:in `block (2 levels) in <class:Engine>'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:590:in `each'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:590:in `block in <class:Engine>'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:30:in `run'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:44:in `each'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
    from /Users/markustorok/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/application.rb:214:in `initialize!'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/markustorok/Dropbox/2Working/WebDesign/Ruby/rails_projects/speiseplan/config/environment.rb:5:in `<top (required)>'
    from /Users/markustorok/Dropbox/2Working/WebDesign/Ruby/rails_projects/speiseplan/config.ru:3:in `require'
    from /Users/markustorok/Dropbox/2Working/WebDesign/Ruby/rails_projects/speiseplan/config.ru:3:in `block in <main>'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from /Users/markustorok/Dropbox/2Working/WebDesign/Ruby/rails_projects/speiseplan/config.ru:in `new'
    from /Users/markustorok/Dropbox/2Working/WebDesign/Ruby/rails_projects/speiseplan/config.ru:in `<main>'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands/server.rb:48:in `app'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands/server.rb:75:in `start'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:80:in `block in <top (required)>'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
    from /Users/markustorok/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
4

1 回答 1

1

配置文件中是否有任何初始化程序或行调用 FourTest 类?因为找不到那个类。首先在您的代码中搜索 FourTest,然后检查您是否遵循包含该类的文件的命名约定,并且它是否位于默认加载的文件夹(模型文件夹)中,或者您在使用它之前手动加载它(lib文件夹等)。

于 2013-05-31T09:06:27.750 回答