Rails:AbstractController :: Helpers :: MissingHelperError - 缺少帮助文件application_helper.rb_helper.rb

时间:2015-01-11 07:22:50

标签: ruby-on-rails ruby-on-rails-4

找不到任何帮助我的资源!当我尝试'rails s'并转到应用程序的任何页面时;它向我发送了这个错误页面,说我错过了帮助文件。

我认为它在我的桌面计算机上是本地的,因为我最近在笔记本电脑上对应用程序做了一些工作。我推出笔记本电脑和应用程序在Heroku上工作正常,并在该机器上运行本地零问题。我添加了一项功能,使用Carrierwave,Mini_Magick和Fog将公司徽标图像上传到Amazon S3。

到目前为止我尝试过的东西:我已经删除了应用程序并将git克隆回到这台机器上。我尝试过Brew卸载/安装imagemagick,并在克隆应用程序后完成了所有基础知识,如bundle install,rake db:migrate。仍然没有运气..

以下是我在页面上获得的错误代码以及完整的跟踪:

AbstractController::Helpers::MissingHelperError in PagesController#dashboard
Missing helper file helpers//users/jamesfend/sites/feedbackz/app/helpers/application_helper.rb_helper.rb

Extracted source (around line #1):
1 class ApplicationController < ActionController::Base    
2 # Prevent CSRF attacks by raising an exception.
3 # For APIs, you may want to use :null_session instead.
4 protect_from_forgery with: :exception

完整追踪

actionpack (4.2.0) lib/abstract_controller/helpers.rb:151:in `rescue in block in modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:148:in `block in modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:144:in `map!'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
actionpack (4.2.0) lib/action_controller/metal/helpers.rb:93:in `modules_for_helpers'
actionpack (4.2.0) lib/abstract_controller/helpers.rb:108:in `helper'
actionpack (4.2.0) lib/action_controller/railties/helpers.rb:17:in `inherited'
app/controllers/application_controller.rb:1:in `<top (required)>'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `load'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `block in load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:647:in `new_constants_in'
activesupport (4.2.0) lib/active_support/dependencies.rb:456:in `load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:354:in `require_or_load'
activesupport (4.2.0) lib/active_support/dependencies.rb:494:in `load_missing_constant'
activesupport (4.2.0) lib/active_support/dependencies.rb:184:in `const_missing'
app/controllers/pages_controller.rb:1:in `<top (required)>'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `load'
activesupport (4.2.0) lib/active_support/dependencies.rb:457:in `block in load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:647:in `new_constants_in'
activesupport (4.2.0) lib/active_support/dependencies.rb:456:in `load_file'
activesupport (4.2.0) lib/active_support/dependencies.rb:354:in `require_or_load'
activesupport (4.2.0) lib/active_support/dependencies.rb:494:in `load_missing_constant'
activesupport (4.2.0) lib/active_support/dependencies.rb:184:in `const_missing'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:261:in `const_get'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:261:in `block in constantize'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `each'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `inject'
activesupport (4.2.0) lib/active_support/inflector/methods.rb:259:in `constantize'
activesupport (4.2.0) lib/active_support/dependencies.rb:566:in `get'
activesupport (4.2.0) lib/active_support/dependencies.rb:597:in `constantize'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:59:in `controller'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:38:in `serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.0) lib/rack/etag.rb:24:in `call'
rack (1.6.0) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.0) lib/rack/head.rb:13:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.0) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.0) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
activerecord (4.2.0) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.0) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.0) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.0) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.0) lib/rack/sendfile.rb:113:in `call'
railties (4.2.0) lib/rails/engine.rb:518:in `call'
railties (4.2.0) lib/rails/application.rb:164:in `call'
rack (1.6.0) lib/rack/lock.rb:17:in `call'
rack (1.6.0) lib/rack/content_length.rb:15:in `call'
rack (1.6.0) lib/rack/handler/webrick.rb:89:in `service'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/jamesfend/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

页面控制器

class PagesController < ApplicationController

  def dashboard
    @title = 'Feedbackz by Amazio Labs'
    @header_title = 'Dashboard'
  end

  def billing
    @title = 'Billing & Plans - Feedbackz by Amazio Labs'
    @header_title = 'Billing & Plans'    
    @user = User.find(current_user.id)
  end

  def contact
    @title = 'Contact - Feedbackz by Amazio Labs'
    @header_title = 'Contact Us'    
  end

  def faq
    @title = 'FAQ - Feedbackz by Amazio Labs'
    @header_title = 'Frequently Asked Questions'    
  end

  def invoices
    @title = 'Invoices - Feedbackz by Amazio Labs'
    @header_title = 'Invoices'    
  end  

  def videos
    @title = 'Videos - Feedbackz by Amazio Labs'
    @header_title = 'Helpful Videos'    
  end

  def schedule
    @title = 'Schedule - Feedbackz by Amazio Labs'
    @header_title = 'Schedule of Pending Sends'    
  end

end

14 个答案:

答案 0 :(得分:19)

这对我有用:

cd ~
mv sites tmpsites
mv tmpsites sites

我也这样做了,但不确定是否需要:

cd /
sudo ln -s Users users

奇怪的是,我看不到小写的users符号链接,但ls /usersls /Users都有效。

答案 1 :(得分:9)

循序渐进指南:

在OSX上,我已将用户名从Psy更改为psy。因此,解决问题是屁股的痛苦。按照这些步骤帮助我:

  1. 运行irb并在项目文件夹中执行此命令:

    File.expand_path("./")
    # => "/Users/psy/code/rails_app"
    
  2. 现在退出irb并在shell中运行此命令:

    $ pwd
    # => /Users/Psy/code/rails_app
    
  3. 比较两者并注意具有案例差异的目录,在这种情况下它是Psy

  4. 将该目录重命名为任何内容,然后将其重命名回原始文件夹(如有必要,请仅使用sudo

    $ sudo mv /Users/Psy /Users/tmp
    $ sudo mv /Users/tmp /Users/Psy
    

答案 2 :(得分:4)

虽然Zubin提供的答案在我的个人计算机上为我工作,但我刚刚在工作机器上遇到了同样的问题。我创建了一个小写的网站:

mkdir sites 

使用大写 s重命名修复它。

mv sites Sites

答案 3 :(得分:3)

我发现只重命名网站文件夹对我来说就像Zubin指出的那样。我没有做sudo ln命令。

mv sites sites1
mv sites1 sites

答案 4 :(得分:1)

简单地移动/重命名文件夹并不适合我。我不得不重命名现有文件夹,创建一个具有相同名称的新文件夹,然后将所有内容复制到它。然后我删除了旧的重命名文件夹。

答案 5 :(得分:1)

对我来说,这个问题是因为我在Windows上使用GitBash,并从那里运行我的测试。看起来像bash期望的实际文件夹名称不匹配。从cmd跑出来并且工作正常。

答案 6 :(得分:1)

如果您使用的是Windows和Powershell,则在文件系统中具有特定大小写的目录中运行rails srails server时会发生此问题,但是如果您已更改为Powershell中的目录使用不同的大写。

例如,在我的Windows文件系统上,我的rails网站位于:

C:/Code/Personal-Website

但是我在powershell中运行了以下命令来启动我的服务器:

C:\Users\XXX XXX> cd C:/code/personal-website

C:\code\personal-website> rails s

Powershell认为启动服务器的位置与服务器的文档根目录在文件系统中的位置之间的这种情况不匹配似乎会导致问题,并确保您的Powershell位置案例与Windows中的目录匹配将阻止它。

答案 7 :(得分:0)

我得到了与上面相同的错误,但这不是由于案件问题。它最终归结于各种因素。我安装了两个ruby版本管理器-rvm和rbenv-我使用的是旧的gem安装程序。我不得不卸载rvm(How can I remove RVM (Ruby Version Manager) from my system?)并重新安装rbenv(brew重新安装rbenv)并升级到最新版本的ruby。然后我不得不更新rubygems(gem update --system)。然后,重新安装所有宝石并重新启动,一切都已修复。

基本上,我的ruby经理指向旧版本的ruby并使用过时版本的gem installer(2.2.0)。只需升级到rubygems,您就可以解决问题。

我花了一天半的时间来解决这个问题。希望这可以节省一些时间和挫折。

答案 8 :(得分:0)

我在运行测试时开始收到相同的丢失助手消息,即使我的应用程序在开发模式下运行正常。这是在我成功运行测试之后开始的,没有我知道的系统更改。在尝试从我的路径中删除大写文件名但没有成功后,我运行了rvm,在我的情况下

rvm use ruby-2.2.0@rails4.2
bundle install

问题消失了。我怀疑我的系统已重新启动并开始使用一些不兼容的系统Ruby模块。我是一名初学者,正在通过迈克尔·哈特尔的OS X 10.10.3轨道教程。

答案 9 :(得分:0)

我也遇到过这个错误。这里的所有解决方案都没有成功,我尝试了不同的东西。这是我的解决方案,也可以帮助其他人:

在我的项目路径中,有一个带有元音突变的文件夹/“Umlaut”(ü,ö,ä等)。 所以我改变了一切,一切正常。

答案 10 :(得分:0)

这不是真正的ruby或Rails错误,因为它是OSX(恕我直言)中的一个缺陷,因为多年前设计决定保持与OS 8.0(经典MacOS)的兼容性并提供与Windows FAT /的更好的兼容性NTFS。该决定是使用案例保留但不区分大小写的命名方案实现HFS +,其中以下路径是等效的:

 /tmp/CASE_insensitive
 /tmp/case_INSENSITIVE

您可以在以下quora帖子中阅读更多相关信息:

Why does OS X choose to have a case-insensitive file system instead of a case-sensitive one?

如果你曾经配置过一个HFS +文件系统来强制区分大小写(你知道,为了与实际的* nix文件系统更兼容),你很可能会碰到那些在OSX上破解的软件,因为该软件已经有些不小心写了假设没有不区分大小写的情况(IIRC,某些Adobe软件在HFS +上具有区分大小写的麻烦)。

在OSX终端中尝试:

 prompt>mkdir /tmp/CASE_insensitive
 prompt>cd /tmp/case_INSENSITIVE
 prompt>pwd
 /tmp/case_INSENSITIVE
恕我直言,那太乱了。现在,如果您在OSX系统上使用Pow,当您在~/.pow目录中创建指向您的Rails应用程序的符号链接时,请注意这种情况。在此处错误输入案例将导致OP注意到错误。只需使用适当的大小写删除和重命名符号链接就可以正确解决这个问题。

答案 11 :(得分:0)

我在控制台中使用了“弹簧停止”功能。

答案 12 :(得分:0)

我在Windows Powershell而不是cmd上运行rails s时遇到此错误。 我建议使用其他CLI。

答案 13 :(得分:0)

我从

得到这个错误

rails g controller Name

我刚刚删除了控制器

rails d controller Name

然后用小写再次生成

rails g controller name

相关问题