Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Issue with helpers being available in production mode - Rails 3.1.rc4 #1782

shedd opened this Issue · 3 comments

2 participants


I'm having an issue with my application that I upgraded from Rails 2.3.12 to Rails 3.1.rc4.

My application layout references a helper method in app/helpers/notification_helper.rb. As a result of the method being referenced in the application layout, there are thus pages within multiple controllers that need access to this helper.

The upgraded application controller has "helper :all" at the top of the file. In Rails 2.3.x this allowed all helpers to be accessible at all times.

However, in Rails 3.1.x, I get exceptions in production mode from any controller that loads a page that refers to this helper. I have checked and double checked that the method call is the same as the method name, etc. In development mode, I have no issues.

I found this changelog reference which stated that helper :all is the default in Rails 3.1.

* Added `config.action_controller.include_all_helpers`. By default `helper :all` is done in `ActionController::Base`, which includes all the helpers by default. Setting `include_all_helpers` to false will result in including only `application_helper` and helper corresponding to controller (like `foo_helper` for `foo_controller`). [Piotr Sarnacki]


I tried removing helper :all from my application controller (leaving only the supposed default). No change. Rails can't find the helper method with this line in place or without it.

I also tried explicitly setting "config.action_controller.include_all_helpers = true" in both production.rb and application.rb. No change.

The only thing that works is to explicitly state

helper :notification_helper

in each controller that refers to this method.

I don't get why this isn't working as it should - it seems that nothing has changed with how helper :all should work.

In the meantime, I am going to move all of my helpers into application_helper.rb, as it seems that is the only helper file that works reliably. Having the method in application_helper works as expected.

Any ideas what is going on here? Thanks!


I can't reproduce this in a newly generated app using 3.1.rc4 using 1.8.7 or 1.9.2 - I'd suggest it's either something left over in an environment.rb file or a problem caused by a plugin / gem. If you can post some steps to reproducing the issue or a github repo exhibiting the problem then I'll reopen and have a look.

@pixeltrix pixeltrix closed this

Thanks for the reply.

I setup a new 3.1.rc4 application with the gemfile from the existing app, along with all of the production and environment settings brought over. I created an example case and it seems to work in the fresh app (as you saw), so I spent the latter half of the morning pulling things out of the existing app, trying to trace what it interfering with the helper loading. I brought in the plugins from the previous app, along with methods from the application controller. I haven't found what's blocking the helpers yet.

Any suggestions on what might block the helpers from being available to all controllers when otherwise configured to be? Aside from adjusting the required items for the transition from Rails 2 -> 3.1, the app is the same. No substantial recoding has been done, other than reconfiguration and swapping out some gems (will paginate to kaminari, etc.)

One other issue that I've run into is when my Rails 3.1 app hits an exception in local production mode (like the missing helper method), Mongrel starts to suck up ram like crazy. It spikes from 200-300 MB, which seems to be about normal, up to 2 GB with 100% CPU and doesn't relent until the process is killed. No exception is ever displayed in these cases.

Any ideas on where to look regarding the helper issue? It would be nice to be able to pull all of my helper methods out of the application helper and have them segmented properly. Thanks!


The only thing I can suggest is checking the values of ApplicationController._helpers.ancestors and ApplicationController.helpers_path in the console and make sure that the path is in the list of the latter - also make sure that ApplicationController.include_all_helpers is true. The fact that it works in development mode seems to indicate that AS::Dependencies.load_missing_constant is loading NotificationHelper and when it is turned off in production it's not being eagerly loaded correctly. Is there anything unusual about your paths?

As for the memory leak it could be anything - just eliminate the variables, e.g. does it happen with webrick, unicorn, etc.

@jake3030 jake3030 referenced this issue from a commit in jake3030/rails
Greg Borenstein add an inspect method to OrderedHash to make it clear that it is not …
…a species of Array

Signed-off-by: Michael Koziarski <>
[#1782 state:committed]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.