Why can I access helper methods for one controller in the views for a different controller? Is there a way to disable this without hacking/patching Rails?
views:
801answers:
2
+1
Q:
Why are all Rails helpers available to all views, all the time? Is there a way to disable this?
+10
A:
Delete the following line from ApplicationController
helper :all
In this way each controller will load its own helpers.
Simone Carletti
2009-07-24 20:08:03
+1
A:
Actually in Rails 2, the default functionality of ActionController::Base was to include all helpers.
Changeset 6222 on 02/24/07 20:33:47 (3 years ago) by dhh: Make it a default assumption that you want all helpers, all the time (yeah, yeah)
change:
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
end
As of Rails 3 beta 1, that is no longer the case as noted in the CHANGELOG:
- Added that ActionController::Base now does helper :all instead of relying on the default ApplicationController in Rails to do it [DHH]
databyte
2010-05-07 03:46:47
so does that mean in Rails 3, all helpers are by default all the time loaded?
Nik
2010-09-02 11:10:47