33

I am not sure , but this might be associated with a crashed computer. After restarting (after the crash) I get a missing helper error where the helper name is wrong. Switching branches has no effect on the outcome.

The error is:

Missing helper file helpers//users/xxxx/sites/xxxx/app/helpers/accounts_helper.rb_helper.rb

Ive tried updating gems, uninstalled rails and reinstalled, checked helper names and anywhere helpers are included. Ive also reviewed git logs and checked recently changed code. No luck.

Stack Trace

Started GET "/" for 127.0.0.1 at 2015-01-09 17:53:57 -0700
  ActiveRecord::SchemaMigration Load (1.1ms)  SELECT "schema_migrations".* FROM "schema_migrations"

AbstractController::Helpers::MissingHelperError - Missing helper file helpers//users/xxxx/sites/xxxx/app/helpers/accounts_helper.rb_helper.rb:
  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 `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 `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 `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 `block in constantize'
  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 `serve'
  actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
  bullet (4.14.0) lib/bullet/rack.rb:10:in `call'
  meta_request (0.3.4) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
  meta_request (0.3.4) lib/meta_request/middlewares/meta_request_handler.rb:13: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 `_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'
  better_errors (2.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (2.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (2.1.0) lib/better_errors/middleware.rb:57:in `call'
  rack-contrib (1.2.0) lib/rack/contrib/response_headers.rb:17:in `call'
  meta_request (0.3.4) lib/meta_request/middlewares/headers.rb:16:in `call'
  web-console (2.0.0) lib/action_dispatch/debug_exceptions.rb:18:in `middleware_call'
  web-console (2.0.0) lib/action_dispatch/debug_exceptions.rb:13: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'
  rack-mini-profiler (0.9.2) lib/mini_profiler/profiler.rb:300: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/Hank/.rvm/rubies/ruby-2.2.0-rc1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /Users/Hank/.rvm/rubies/ruby-2.2.0-rc1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /Users/Hank/.rvm/rubies/ruby-2.2.0-rc1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
1
  • I ended up having to create a new rails app, use schema for migrations, and move views, assets, etc over to the new app. Still not sure where the corruption originated or what caused it.
    – hellion
    Jan 11, 2015 at 19:18

17 Answers 17

51

The problem seems to have been introduced in the latest version of ruby, ruby 2.2.0.

Try this experiment:

in rails console/or irb:

[1] pry(main)>File.expand_path ("./") 
=> "/users/xxxx/Sites/xxxx"

and in the terminal window:

]$ pwd
/users/xxxx/sites/xxxx

See the different case? If you get that, then deep in the bowels of active support a regex goes south. One fix is to remove the "sites" directory and recreate. It might also work to rename the sites directory using the finder, as rename it to "foobar" and then back to "sites".

hth.

(from this page in Japan) http://translate.google.com/translate?hl=en&sl=ja&u=http://d.hatena.ne.jp/jiikko/20150108&prev=search

And when I was debugging this with another person, it was enough to have a mixed case directory name in the path. We renamed it to 'farknerd' and then back the original, except all lower case, and it worked.

7
  • so here is the github.com/rails/rails/issues/18660, which is a rails take on it. Some people seem to think it should be fixed there.
    – Rob
    Mar 11, 2015 at 20:31
  • Had the same problem here. To fix it I just used File.expand_path ("./") from pry to see which folders were uppercase and I renamed them all to lower case and everything worked like magic. Thanks for the direction, really helped! May 5, 2015 at 16:21
  • Thanks! It would have taken me forever to notice that!
    – Arel
    Jun 3, 2015 at 19:02
  • Wow, you saved my time. It's really weird though, considering it worked before and I don't make any changes both on Rails and Ruby version. Anyway, kudos for the finding!
    – fruqi
    Jul 21, 2015 at 14:47
  • God this is a terrible (albeit working) solution to a terrible problem. I can't believe this is still an issua with Rails 4.2.4 on Ruby 2.2.3. But thanks. Aug 31, 2015 at 10:23
11

For me, the folder 'sites' only needed to be renamed, not the entire directory.

from my user root directory I did this...

mv sites sites1
mv sites1 sites
0
8

Following Rob's instructions, I found it necessary to rename + lowercase every folder in the filepath up to 'Users' before my error went away.

4
  • Thanks, Rob! Both returned the same path with the same case. I'm still unsure of the root cause of the problem. My work-around was to create a brand new app and update it to the current status of the old app.
    – hellion
    Jan 15, 2015 at 23:27
  • I also has the same problem and renaming all directories to lowercase fixed it.
    – Nicolas
    Jan 23, 2015 at 18:02
  • I don't think it is a rails issue, I think it is this ruby issue bugs.ruby-lang.org/issues/10700. They were trying to fix some edge case finding files with OSX and a case-sensitive file systems. I'm guessing they tested against a Mac OSX machine that had a case sensitive file system (who does that??) and "fixed" the bug, but broke it for the rest of us.
    – Rob
    Feb 3, 2015 at 23:49
  • I had to rename every file, lowercase and mixed case. After that all was good and i could restore the original name. Apr 24, 2015 at 8:46
3

Mine also was a case issue. I was initially in the folder C:\users\pxxx\projects\odot which was throwing the above error. When I changed to C:\Users\Pxxx\projects\odot it seemed to work

1
  • This worked for me as well. In the terminal I was running the server in C:\users\a..., I used cd C:\Users\A... and now it works
    – Adam12344
    Dec 5, 2016 at 19:48
3

I got this error after creating a helpers directory for the first time.

The problem went away after running spring stop and trying again.

0
1

The problem..

For me the same issue with the error

 "missing helper file app/helpers/application_helper.rb_helper.rb"

The app was located in a directory tree

/Users/grantsayer/Documents/Work/recipes

So on conducting the test to show the path, both from within the terminal and within the ruby environment I found the following:

1. Ruby environment

Grants-MacBook-Pro:Recipes grantsayer$ irb

2.2.0 :001 >

2.2.0 :002 > File.expand_path("./") => "/Users/grantsayer/Documents/Work/Recipes"

2. Unix Terminal

Grants-MacBook-Pro:Recipes grantsayer$ pwd /Users/grantsayer/Documents/Work/recipes

At this stage running the rails server and navigating to http://localhost:3000 resulted in the error about a missing application helper. This error, as others have described, appears to be a bug within ruby causing case conversion on the file path.

I solved the issue by renaming the recipes folder to Recipes so that the ruby environment check in irb matched the local filesystem.

1

I had the same problem, apparently related to dropbox, but not case sensitive as others have suggested.

Following @Rob's answer, the output of [1] pry(main)>File.expand_path ("./") resulted in:

/Users/xxxx/dropbox/xxxx

and the output of ]$ pwd also resulted in:

/Users/xxxx/dropbox/xxxx

Following @Beengie's instructions, from my Users root directory, I did:

mv Dropbox Dropbox1
mv Dropbox1 Dropbox

This solves the problem for me -- until I reboot, at which point I have to perform the operation again. I'm still looking for a permanent fix.

1

I had the same problem, but NO user-created directories that had uppercase letter in them... only /Users.

I tried upgrading to ruby 2.2.1 - this did not fix it.

I very hesitantly fixed it by doing the same case-sensitive "fix" on my /Users directory:

cd /
sudo mv Users users1
sudo mv users1 users

I have yet to see if that breaks anything else....

1

I had the same issue using powder gem. Here is how I fixed it:

powder unlink
powder link
1

This had been bugging me for so long. I didn't find any joy with attempting to rename the files or directories.

I did, however, find a really easy fix. Simply go into the main directory of your project and run 'bundle install'. It installed all of the gem dependencies (without overwriting any data I had written) which effectively fixed any issues.

Opened up the rails server and hurrah, normal service was resumed.

Hope that helps!

0

I'm running 2.2.0 and did as @Rob said and found that it was my the apps root directory that had the problem since it had a capitalized name. I'm also not keeping the app in the Sites directory but another sibling directory.

0

Had the same problem on Ruby 2.2.0 and i only managed to fix it by changing the folder structure from

/Users/xxx/Documents/Ruby/xxxx

to

/Users/xxx/Documents/ruby/xxxx

So lower case the folder name

1
  • 1
    When using Pow, I found that I could change the symlink to use the appropriate case. In my case, I needed to upcase 'documents' Jul 8, 2015 at 15:02
0

I got the same error as above, but it was not due to a case issue. It ended up being due to a combination of things. I had two ruby version managers installed- rvm and rbenv- and I was using an old gem installer. I had to uninstall rvm (How can I remove RVM (Ruby Version Manager) from my system?) and reinstall rbenv (brew reinstall rbenv)and upgrade to the lastest version of ruby. Then I had to update rubygems (gem update --system). Then, reinstalled all gems and a reboot and everything was fixed.

Essentially, my ruby manager was pointing to an old version of ruby and using an outdated version of the gem installer (2.2.0). You might be able to fix things with just an upgrade to rubygems.

It took me a day and a half to get this resolved. Hopefully, this will save someone some time and frustration.

0

I had a dash in one of my directories: the-mission which was also causing an error. In addition to making sure all of your parent directories are lowercase (including changing Desktop to desktop), also make sure the only characters in your directory names are letters.

0

in my case i was using windows. Using Git shell, i kept getting this error while trying to install the gem administrate from thoughtbot. The command that kept giving me the error,"AbstractController::Helpers::MissingHelperError", was:

$ rails generate administrate:install

I did not rename my folder's to lowercase as many answers have suggested. I instead used the window's cmd. It worked perfectly.

0

This happened to me after I updated Rubymine. All i did was changing the folder of my website from HelloWord to helloword. Removed capital and other symbol and it works fine.

0

I was having this problem after generating a new controller using the command

rails generate controller Microposts

It was breaking my entire test suite.

If I reversed the command using: rails destroy controller Microposts

it would go green again.

I managed to fix the problem by running: gem update

After destroying the controller and then generating it again once the gems had been updated.

Oddly enough I got this message when regenerating:

"The name 'MicropostsHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative or use --force to skip this check and run this generator again."

Which was not appearing before I updated my gems, and no longer have any issues.

I use RVM and used this to make sure I was running the command on the same version of Ruby my app was using.

Not the answer you're looking for? Browse other questions tagged or ask your own question.