18

Can't find any resource that's helped me in this! When I try to 'rails s' and go to any page of the app; it shoots me this error page saying I am missing helper files.

I think it's local on my desktop machine because I recently did some work to the app on my laptop. I pushed from the laptop and app works fine on Heroku and runs local on that machine with zero problems. I added a feature to upload company logo images using Carrierwave, Mini_Magick, and Fog to Amazon S3.

Things I've tried so far: I've deleted the app and git clone it back to this machine. I've tried Brew uninstall/install imagemagick and did all the basics like bundle install, rake db:migrate after I cloned the app. Still no luck..

Here is the error codes I am getting on the page and also the full trace:

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

Full Trace

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'

Pages Controller

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
James F
  • 896
  • 2
  • 11
  • 18
  • Do you have something like `helper :application_helper.rb` in your PagesController, or anywhere else in your app? If so, it should just be shortened to `helper :application`. – sevenseacat Jan 11 '15 at 07:28
  • hey, thanks for your quick reply. I ran a folder-wide search for "application_helper" and no matches anywhere in the code unfortunately. – James F Jan 11 '15 at 07:33
  • can you also attach code from PagesController? – mswiszcz Jan 11 '15 at 10:51
  • @swistaku - pasted.. – James F Jan 11 '15 at 18:03
  • for me it seems like ruby/rails bug, check here http://stackoverflow.com/questions/27871726/strange-error-in-rails-missing-helper and here http://d.hatena.ne.jp/jiikko/20150108 – mswiszcz Jan 11 '15 at 18:21
  • Thank you.. after reading that; I opted to try to re-install everything! and in the process; I think I broke rvm, xcode, or something. Either way; I'm just re-booting the entire OSX from scratch. – James F Jan 12 '15 at 01:40
  • Update: So I had this happen to me again.. I did Zubin's answer minus the second part and it fixed it. Weird... thanks guys! – James F Feb 16 '15 at 07:47

14 Answers14

20

This worked for me:

cd ~
mv sites tmpsites
mv tmpsites sites

I also did this, but am unsure if it was required:

cd /
sudo ln -s Users users

Oddly, I can't see the lowercase users symlink, but both ls /users and ls /Users work.

Zubin
  • 8,254
  • 7
  • 42
  • 52
  • I did the first part and it worked like a charm.. I didn't have to do the second. Thanks man! You're a life saver.. – James F Feb 16 '15 at 07:47
  • could you explain how this solved the problem, or how this solution relates to the question? – Todd Feb 05 '21 at 22:56
  • I don't recall how or why this worked; only that it somehow resolved the issue even though it didn't seem to make sense! – Zubin Feb 13 '21 at 01:40
16

I solved with "spring stop" in the console.

  • 2
    I was getting AbstractController::Helpers::MissingHelperError: showing a custom controller helper was missing when I ran the test suite. Running "spring stop" as suggested at the terminal (Linux) and rerunning the test suite was immediately successful with no other action required. – Daniel Nalbach Oct 05 '19 at 19:14
  • 2
    Could you explain with more details why this happens? – João Pedro Schmitt Oct 12 '20 at 13:40
  • Id suggest this be the accepted answer – Todd Feb 05 '21 at 22:57
11

Step-by-Step Guide:

On OSX, I had changed my username to Psy from psy. So figuring the problem out was a pain in the ass. Following these steps helped me out:

  1. Run irb and execute this command in your project folder:

    File.expand_path("./")
    # => "/Users/psy/code/rails_app"
    
  2. Now exit irb and run this command in your shell:

    $ pwd
    # => /Users/Psy/code/rails_app
    
  3. Compare the two and notice the directory with the case difference, in this case it's Psy

  4. Rename that directory to anything, and then rename it back to the original folder (use sudo only if necessary)

    $ sudo mv /Users/Psy /Users/tmp
    $ sudo mv /Users/tmp /Users/Psy
    
Sheharyar
  • 65,583
  • 19
  • 152
  • 196
4

While the answer Zubin provided worked for me on my personal machine I just ran into the same issue on a work machine where it didn't exactly. I'd created sites as a lowercase dir:

mkdir sites 

Renaming with a capital s fixed it.

mv sites Sites
Mischa Colley
  • 123
  • 2
  • 12
3

I found that renaming only the sites folder worked for me just like Zubin pointed out. I did not do the sudo ln command.

mv sites sites1
mv sites1 sites
Beengie
  • 1,364
  • 4
  • 14
  • 30
1

Simply moving/renaming the folder didn't work for me. I had to rename the existing folder, create a new folder with the same name, then copy everything to it. Then I deleted the old renamed folder.

joshua.paling
  • 12,854
  • 3
  • 38
  • 57
1

For me this issue was caused because I was using GitBash on Windows, and running my tests from there. Looks like a case mismatch on what bash is expecting vs the actual folder names. Ran it from cmd and worked fine.

user1008724
  • 73
  • 1
  • 8
1

If you are using Windows and Powershell, this issue can occur when running rails s or rails server from a directory which has a certain capitalisation in the filesystem, but if you have changed into the directory in Powershell using a different capitalisation.

For example on my Windows filesystem my rails site is located at:

C:/Code/Personal-Website

however I ran the following commands in powershell to start my server:

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

C:\code\personal-website> rails s

This case mismatch between where Powershell thinks it is starting the server versus where the server's document root actually is in the filesystem seems to cause the problem, and ensuring that your Powershell location case matches that of the directories in Windows will stop it.

HellaWiggly
  • 157
  • 2
  • 6
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.

Community
  • 1
  • 1
0

I started getting the same missing helper message when running tests, even though my app ran OK in dev mode. And this started right after I had run my tests successfully, with no system changes that I was aware of. After trying the suggestion to remove uppercase filenames from my path without success, I ran rvm, in my case

rvm use ruby-2.2.0@rails4.2
bundle install

The problem went away. I suspect my system had rebooted and started using some incompatible system Ruby module. I am a beginner working my way through Michael Hartl's rails tutorial on OS X 10.10.3.

Wacko
  • 1
  • 1
0

I also encountered this error. All the solutions here didn't work out and I tried different things. Here's my solution which might help others too:

In my project path there was a folder with a vowel mutation / "Umlaut" (ü, ö, ä etc.). So I changed that and everything worked.

Florian Pfisterer
  • 1,045
  • 11
  • 20
0

This isn't really a ruby or Rails bug as it is a flaw in OSX (IMHO) resulting from a design decision made many years ago to maintain compatibility with OS 8.0 (classic MacOS) and provide better compatability with Windows FAT/NTFS. That decision was to implement HFS+ with a case preserving but case insensitive naming schema wherein the following paths are equivalent:

 /tmp/CASE_insensitive
 /tmp/case_INSENSITIVE

You can read more about this in the following quora post:

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

If you've ever configured an HFS+ filesystem to enforce case insensitivity (you know, to be more compatible with actual *nix filesystems) you may very well come across software that just breaks on OSX because that software has been somewhat carelessly written to assume no case insensitivity (IIRC, some Adobe software had great trouble with HFS+ with case sensitivity).

Try this in the OSX terminal:

 prompt>mkdir /tmp/CASE_insensitive
 prompt>cd /tmp/case_INSENSITIVE
 prompt>pwd
 /tmp/case_INSENSITIVE

IMHO, that's pretty messed up. Now, if you're using Pow on your OSX system, when you create the symlink in the ~/.pow directory to point to your Rails app, be careful of the case. Mis-typing the case here will result in the error noted by the OP. Simply removing and renaming the symlink with the appropriate case will fix this properly.

markeissler
  • 620
  • 6
  • 8
0

I get this error while running rails s on windows powershell but not on cmd. I sugest using a different CLI.

0

I got this error from

rails g controller Name

I just deleted the controller with

rails d controller Name

Then generated it again with lowercase

rails g controller name