Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationController.helpers_path is empty? #2739

Closed
ghost opened this issue Aug 29, 2011 · 7 comments
Closed

ApplicationController.helpers_path is empty? #2739

ghost opened this issue Aug 29, 2011 · 7 comments

Comments

@ghost
Copy link

ghost commented Aug 29, 2011

Hey,

After upgrading to .rc8, ApplicationController.helpers_path returns an empty array.
This application is one I'm upgrading from Rails2(the upgrade isn't anywhere near ready yet).

Helpers other than those in ApplicationHelper aren't available in ApplicationController._helpers.instance_methods.
If i call reload!, they become available.

config.action_controller.include_all_helpers = true makes no difference here. neither does helper :all.
manually calling helper :foo works, however.

This application worked in respect to helpers on .rc6

Has the boot process changed in anyway?
I can't reproduce this bug on a fresh rails .rc8 project, so anything I can do to debug further would be appreciated.

(Btw, I've tried setting .helpers_path myself, it made no difference).
I'm at a loss as to what might be happening, as it isn't reproducible on a fresh Rails3 .rc8 project.

I realize I'm not providing a reproducible bug, and I'm sorry for that, but I can only reproduce it on my works app, which i can't share unfortunately.

Thanks.

@isaacsanders
Copy link
Contributor

@robgleeson Is this still an issue?

@frodsan
Copy link
Contributor

frodsan commented Apr 30, 2012

@robgleeson @isaacsanders @steveklabnik It's not an issue in master, but it will be nice if you can provide more information.

irb(main):007:0> ApplicationController.helpers_path
=> ["/Users/frodsan/tmp/example/app/helpers"]

@isaacsanders
Copy link
Contributor

👍 on more information.

@steveklabnik
Copy link
Member

I have no idea. :/ Since it's not an issue, I'm going to close, but since this isn't reproducible on a fresh app, I don't even know how to go about figuring out what went wrong.

@iangreenleaf
Copy link
Contributor

I know this is like beyond necrobump, but hey, I had the same problem and tracked down the cause (at least in my case), so figured I'd share.

This can happen if Rails::Application#helpers_paths is called too early, before the configuration object has fully loaded or whatever. In my case, this was because a very old gem was creating an initializer that autoloaded ApplicationController, setting off all the loading much earlier than it otherwise happens. Changing that to a config.to_prepare block solved the problem.

iangreenleaf added a commit to iangreenleaf/browser_detect that referenced this issue Mar 15, 2014
Prevents this gem from loading ApplicationController much too early
in the initialization process, which causes configuration problems.

See rails/rails#2739.
@carlesso
Copy link
Contributor

carlesso commented Nov 9, 2014

@iangreenleaf fucking thank you. I owe you a beer.

@synth
Copy link

synth commented Mar 24, 2017

Holy crud. I just spent about a day debugging this issue. Finally came across this thread which tipped me off, so thank you! In my case the offending gem is grape-rails-routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants