AbstractController :: Helpers :: Rails中的MissingHelperError :: WelcomeController #index

时间:2016-10-09 18:16:12

标签: ruby ruby-on-rails-4

在rails服务器上运行我的第一个ruby应用程序时出现这个错误。有时,我设法通过,有时我会在60%的时间内收到此错误。

My Code

My Error screen

AbstractController::Helpers::MissingHelperError in Rails::WelcomeController#index
Missing helper file helpers/c:/users/benjamin/desktop/pinteresting/app/helpers/application_helper.rb_helper.rb

Rails.root: c:/Users/Benjamin/desktop/pinteresting
Application Trace | Framework Trace | Full Trace

actionpack (4.2.5.1) lib/abstract_controller/helpers.rb:151:in `rescue in block in modules_for_helpers'
actionpack (4.2.5.1) lib/abstract_controller/helpers.rb:148:in `block in modules_for_helpers'
actionpack (4.2.5.1) lib/abstract_controller/helpers.rb:144:in `map!'
actionpack (4.2.5.1) lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
actionpack (4.2.5.1) lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
actionpack (4.2.5.1) lib/abstract_controller/helpers.rb:108:in `helper'
actionpack (4.2.5.1) lib/action_controller/railties/helpers.rb:17:in `inherited'
railties (4.2.5.1) lib/rails/application_controller.rb:1:in `<top (required)>'
activesupport (4.2.5.1) lib/active_support/dependencies.rb:274:in `require'
activesupport (4.2.5.1) lib/active_support/dependencies.rb:274:in `block in require'
activesupport (4.2.5.1) lib/active_support/dependencies.rb:240:in `load_dependency'
activesupport (4.2.5.1) lib/active_support/dependencies.rb:274:in `require'
railties (4.2.5.1) lib/rails/welcome_controller.rb:1:in `<top (required)>'
activesupport (4.2.5.1) lib/active_support/inflector/methods.rb:263:in `const_get'
activesupport (4.2.5.1) lib/active_support/inflector/methods.rb:263:in `block in constantize'
activesupport (4.2.5.1) lib/active_support/inflector/methods.rb:259:in `each'
activesupport (4.2.5.1) lib/active_support/inflector/methods.rb:259:in `inject'
activesupport (4.2.5.1) lib/active_support/inflector/methods.rb:259:in `constantize'
activesupport (4.2.5.1) lib/active_support/dependencies.rb:566:in `get'

1 个答案:

答案 0 :(得分:0)

[已解决] 我遇到了同样的问题。我意识到当你在另一个驱动器上的另一个目录中运行一个新的rails应用程序时(例如D:/)会发生这种情况。我相信你在安装了ruby和devkit 的驱动器中运行它是很重要的(不要忘记安装你的devkit并运行ruby dk.rb init,然后运行ruby dk.rb install)。 / EM>

的步骤

  1. 重新运行gem install rails fresh
  2. 相对于您的ruby安装文件夹运行rails new [my-application-name]

  3. 运行rails s或rails服务器

  4. 耶!您已启动并运行rails应用程序