ruby-on-rails-3 - 为什么我的开发服务器没有加载? default_controller_and_action' : missing :action (ArgumentError)

标签 ruby-on-rails-3 action

我是一名 Ruby nuby(也是 Stack Overflow 的新手),正在处理 Rails Tutorial by Michael Hartl突然间我的开发服务器 won't load and keeps exiting .控制台也不会加载,并且 Rspec spec/会产生错误/异常。我包含了终端的一些输出,非常感谢您的帮助。

Exiting
/Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:164:in `default_controller_and_action': missing :action (ArgumentError)
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:68:in `normalize_options!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:51:in `initialize'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `new'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:261:in `match'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1112:in `match'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/mapper.rb:1297:in `match'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:11:in `block in <top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `instance_exec'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/actionpack-3.0.3/lib/action_dispatch/routing/route_set.rb:233:in `draw'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/routes.rb:1:in `<top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `block in load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `block in reload_routes!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `each'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:127:in `reload_routes!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:120:in `block in routes_reloader'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `call'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/activesupport-3.0.3/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:51:in `block (2 levels) in <module:Finisher>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `call'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config/environment.rb:5:in `<top (required)>'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `require'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:3:in `block in <main>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `new'
    from /Users/ameedachowdhury/rails_projects/railstutorial/config.ru:1:in `<main>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands/server.rb:65:in `start'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:30:in `block in <top (required)>'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Users/ameedachowdhury/.rvm/gems/ruby-1.9.2-p0@rails3tutorial/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
ameeda-chowdhurys-macbook:railstutorial ameedachowdhury$ 

最佳答案

当我遇到这个问题时,是因为routes.rb中的路由之一。使用 / 时有斜杠( # )而不是散列( controller#action )语法(我使用了“ Controller / Action ”,这是不正确的)。

比如我不小心有root :to => 'home/index' .应该是 root :to => 'home#index' .

我在 here 中找到了这个解决方案.

关于ruby-on-rails-3 - 为什么我的开发服务器没有加载? default_controller_and_action' : missing :action (ArgumentError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4568301/

相关文章:

c# - 在 Action<object> 列表中使用多个 Action

ruby-on-rails - 获取 rails Controller 对象的命名空间?

ruby - 覆盖 session Controller 防止使用自定义 View

ruby-on-rails - 将对象添加到收藏夹对象数组中

ruby-on-rails - 如何在生产环境中启动乘客?

ios - 以编程方式调用 iOS 应用程序扩展

java - 停止或中断 libGDX Scene2D 中的 Action

ruby-on-rails - Rails 3 在 "lib"目录中看不到我的类

reactjs - react +通量: best practice for calling an action after another action?

Django 评论需要非 super 用户的删除操作