0

Backstory: Some friends and I were working on an app and wanted to select multiple items for processing on another page. Before we found RailsCast #165, I created a branch and added scaffold for a table with three checkboxes on it just to see what the generated code looked like. Having found the right answer in RC165, I deleted all the code, and the migration, with the intention of abandoning all that work.

Alas, I can't seem to get rid of it as references to it prevent me from doing anything on any branch at all. When I "rake db:migrate" or "rails s" or anything, I get ...

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

... even though the character string "Checks" does appear anywhere in my project directory. I have gone so far as to:

  1. Rename the directory and clone a new project from github (Note: my experiment was never commited even at the local file system level, much less pushed up).
  2. Blow away the Postgress development and test databases

I am at a complete loss to understand how and where Rails is "remembering" my brief experiment and am out of ideas short of blowing away Ruby, Rails, and rbenv, i.e. scraping the machine to bedrock - yuck.

I can't believe that simply backing away from some ill-considered code should be this hard.

Any suggestions on how to solve this or avoid it in the future would be most welcome.

-- Vern

Stack traces follow:

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)
Stuart M
  • 11,458
  • 6
  • 45
  • 59
vemcg
  • 1
  • 1
  • Could it be a gem that is installed causing the problem? Can you blow away your gems or bundle them again? – Phil Apr 27 '13 at 18:39
  • Do you have any `respond_with` or `respond_to` calls in your controllers? – Stuart M Apr 27 '13 at 18:47
  • Looking ... I do have a handful of respond_to calls - none of which make any references outside of the models associated with the controllers - i.e. no "Check"s anywhere. config/initializers/mime_types.rb is more tantalizing (given the error message) but it is all comments, I don't recall ever editing and then reverting it, and I cannot think of any reason I ever would have. I have stopped and tried to start the server many times. Where might registered garbage be persisting? – vemcg Apr 27 '13 at 20:27
  • I have deleted Gemfile.lock and re-run bundle install, then done bundle clean --force and bundle install (which did resolve my pesky rake version problem that required that I use bundle exec) but I am still stuck with ChecksHelper – vemcg Apr 27 '13 at 21:04

1 Answers1

0

You might possibly have

helper :checks

in some controller. This will make rails try to instantiate a class from a corresponding file and upwards.

The weird error message is because if autoload finally fails to find a suitable file to load, the error shows the initial namespace where the class/constant was first searched in.

rewritten
  • 16,280
  • 2
  • 47
  • 50