Rails缺少帮助程序文件(application_helpers.rb)/未找到操作

时间:2017-06-20 02:51:33

标签: ruby-on-rails ruby

我已经好几次在这里看过这个问题,但我得到了额外的东西。我安装Rails(最新版本)并从我的根目录(c :)创建一个新项目。我确保所有文件名都是小写的。我启动了rails服务器,并在第一次请求欢迎页面时得到了 "缺少帮助文件rails / helpers / application_helpers.rb"错误。

Started GET "/" for 127.0.0.1 at 2017-06-19 21:07:21 -0500

AbstractController::Helpers::MissingHelperError (Missing helper file helpers/rails/application_helpers.rb):

actionpack (5.1.1) lib/abstract_controller/helpers.rb:152:in `rescue in block in modules_for_helpers'
actionpack (5.1.1) lib/abstract_controller/helpers.rb:149:in `block in modules_for_helpers'
actionpack (5.1.1) lib/abstract_controller/helpers.rb:145:in `map!'
actionpack (5.1.1) lib/abstract_controller/helpers.rb:145:in `modules_for_helpers'
actionpack (5.1.1) lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
actionpack (5.1.1) lib/abstract_controller/helpers.rb:109:in `helper'

然后我再次请求该页面,并且我获得了欢迎页面。

Started GET "/" for 127.0.0.1 at 2017-06-19 21:08:11 -0500
Processing by Rails::WelcomeController#index as HTML
Rendering c:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.1/lib/rails/templates/rails/welcome/index.html.erb within layouts/application
Rendered c:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-5.1.1/lib/rails/templates/rails/welcome/index.html.erb within layouts/application (27.0ms)
Completed 200 OK in 3690ms (Views: 644.5ms)

对此行为感到困惑,我再次请求欢迎页面,我得到了这个:

Started GET "/" for 127.0.0.1 at 2017-06-19 21:14:47 -0500

AbstractController::ActionNotFound (The action 'index' could not be found for Rails::WelcomeController):

actionpack (5.1.1) lib/abstract_controller/base.rb:119:in `process'
actionview (5.1.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.1) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.1) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.1) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
...and so on

我不知道该怎么做。我在几分钟内要求同样的事情并收到三个不同的结果,没有做任何改变。我卸载了Rails并重新安装。我在不同的文件位置打开了三个新项目,结果几乎相同。我刚获得了Ruby Silver认证,并且真的想学习使用Rails,但我无法通过一个简单的GET请求索引页面...我已经阅读了所有相关问题的帖子,这里和似乎重命名目录修复了存在的问题,但不适合我。

我正在运行Windows 10

Ruby 2.3.3p222

Rails 5.1.1

0 个答案:

没有答案