0

背景故事:我和一些朋友正在开发一个应用程序,想选择多个项目在另一个页面上进行处理。在我们找到RailsCast #165之前,我创建了一个分支并为一个带有三个复选框的表添加了脚手架,以查看生成的代码是什么样的。在 RC165 中找到正确答案后,我删除了所有代码和迁移,打算放弃所有这些工作。

唉,我似乎无法摆脱它,因为对它的引用会阻止我在任何分支上做任何事情。当我“rake db:migrate”或“rails s”或任何东西时,我得到......

uninitialized constant ActionController::MimeResponds::ChecksHelper (NameError)

...即使字符串“Checks”确实出现在我的项目目录中的任何位置。我已经做到了:

  1. 重命名目录并从 github 克隆一个新项目(注意:即使在本地文件系统级别,我的实验也从未提交过,更不用说推送了)。
  2. 吹走 Postgress 开发和测试数据库

我完全不知道 Rails 是如何以及在哪里“记住”我的简短实验的,而且我没有想法可以吹走 Ruby、Rails 和 rbenv,即将机器刮到基石上——呸。

我无法相信仅仅放弃一些考虑不周的代码就这么难。

任何有关如何解决此问题或将来避免此问题的建议都将受到欢迎。

——弗恩

堆栈跟踪如下:

Verns-MacBook-Pro:Portfolio-Project-1-User-Stories vern$ git branch
* master
Verns-MacBook-Pro:Portfolio-Project-1-User-Stories vern$ rails s
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/metal/mime_responds.rb:11:in `<module:MimeResponds>': uninitialized constant ActionController::MimeResponds::ChecksHelper (NameError)
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/metal/mime_responds.rb:6:in `<module:ActionController>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/metal/mime_responds.rb:5:in `<top (required)>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/base.rb:196:in `<class:Base>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/base.rb:171:in `<module:ActionController>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_controller/base.rb:3:in `<top (required)>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sorcery-0.8.1/lib/sorcery/engine.rb:11:in `block in <class:Engine>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/vern/RoR/Portfolio-Project-1-User-Stories/config/environment.rb:5:in `<top (required)>'
    from /Users/vern/RoR/Portfolio-Project-1-User-Stories/config.ru:3:in `block in <main>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/vern/RoR/Portfolio-Project-1-User-Stories/config.ru:in `new'
    from /Users/vern/RoR/Portfolio-Project-1-User-Stories/config.ru:in `<main>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
    from /Users/vern/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Verns-MacBook-Pro:Portfolio-Project-1-User-Stories vern$ rake db:migrate
rake aborted!
You have already activated rake 10.0.4, but your Gemfile requires rake 10.0.3. Using bundle exec may solve this.
/Users/vern/RoR/Portfolio-Project-1-User-Stories/config/boot.rb:6:in `<top (required)>'
/Users/vern/RoR/Portfolio-Project-1-User-Stories/config/application.rb:1:in `<top (required)>'
/Users/vern/RoR/Portfolio-Project-1-User-Stories/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Verns-MacBook-Pro:Portfolio-Project-1-User-Stories vern$ bundle exec rake db:migrate
rake aborted!
uninitialized constant ActionController::MimeResponds::ChecksHelper
/Users/vern/RoR/Portfolio-Project-1-User-Stories/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
4

1 回答 1

0

你可能有

helper :checks

在某些控制器中。这将使 rails 尝试从相应的文件和向上实例化一个类。

奇怪的错误消息是因为如果 autoload 最终无法找到合适的文件来加载,错误会显示第一次在其中搜索类/常量的初始命名空间。

于 2016-12-11T21:55:25.793 回答