1

実行しようとしていますがrails server、次のようなものが表示されています。

C:\Users\Mama  i Tata>cd  c:/rails_project/my_app

c:\rails_project\my_app>rails s
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
c:/rails_project/my_app/config/routes.rb:1:in `<top (required)>': uninitialized
constant SampleApp (NameError)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `block in load_paths'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `load_paths'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:16:in `reload!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:26:in `block in updater'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `call'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `execute'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:27:in `updater'
    from C:in `execute_if_updated'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/finisher.rb:66:in `block in <module:Finisher>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `instance_exec'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:55:in `block in run_initializers'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `run_initializers'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation.rb:136:in `initialize!'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/railti
e/configurable.rb:30:in `method_missing'
    from c:/rails_project/my_app/config/environment.rb:5:in `<top (required)

    from c:/rails_project/my_app/config.ru:4:in `require'
    from c:/rails_project/my_app/config.ru:4:in `block in <main>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
51:in `instance_eval'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
51:in `initialize'
    from c:/rails_project/my_app/config.ru:1:in `new'
    from c:/rails_project/my_app/config.ru:1:in `<main>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
40:in `eval'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
40:in `parse_file'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2
00:in `app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:46:in `app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:3
01:in `wrapped_app'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2
52:in `start'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:70:in `start'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:55:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `tap'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Ruby 1.9.3p194(2012-04-20)[i386-mingw32]を使用しています。

何かアイデアはありますか?

4

1 に答える 1

4

第 5 章のデバッグ ログと Rails チュートリアルによると、routes ファイルをコピーして貼り付けようとしたことを理解しています。

SampleApp::Application.routes.draw do
  get "static_pages/home"
  .......
end

SampleApphere はアプリケーションの名前を表し、ディレクトリ名からはMyApp.

ルート ファイルは次のようになります。

MyApp::Application.routes.draw do
  get "static_pages/home"
  .......
end

それは単なる初見の推測です。

于 2012-07-27T21:19:58.923 に答える