aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-25 09:50:01 +1100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-25 09:50:01 +1100
commit4e96442c4e404141830b2d7f0d850b6556190b39 (patch)
treea3ca088ad9d68b5be9ace4d431375bb3fd4ea045 /actionpack/lib/action_controller
parenta74a655648618a6ed568b9b4ef3a17a8970e7774 (diff)
parent396003fc48d7c0ba206ad059646c7414bee22a36 (diff)
downloadrails-4e96442c4e404141830b2d7f0d850b6556190b39.tar.gz
rails-4e96442c4e404141830b2d7f0d850b6556190b39.tar.bz2
rails-4e96442c4e404141830b2d7f0d850b6556190b39.zip
Merge branch 'master' of git://github.com/rails/rails
Conflicts: actionmailer/lib/action_mailer/mail_helper.rb railties/lib/rails/configuration.rb
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/base.rb2
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb17
-rw-r--r--actionpack/lib/action_controller/railtie.rb19
3 files changed, 13 insertions, 25 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index f46231d72b..215b70734c 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -7,7 +7,6 @@ module ActionController
include AbstractController::Translation
include ActionController::Helpers
- helper :all # By default, all helpers should be included
include ActionController::HideActions
include ActionController::UrlFor
@@ -67,6 +66,7 @@ module ActionController
def self.inherited(klass)
::ActionController::Base.subclasses << klass.to_s
super
+ klass.helper :all
end
def self.subclasses
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index cdd14560e1..0e3db86861 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -50,9 +50,8 @@ module ActionController
include AbstractController::Helpers
included do
- # Set the default directory for helpers
- extlib_inheritable_accessor(:helpers_dir) do
- defined?(Rails.root) ? "#{Rails.root}/app/helpers" : "app/helpers"
+ extlib_inheritable_accessor(:helpers_path) do
+ defined?(Rails::Application) ? Rails::Application.paths.app.helpers.to_a : []
end
end
@@ -105,10 +104,16 @@ module ActionController
raise e unless e.missing_name? "#{module_name}Helper"
end
- # Extract helper names from files in app/helpers/**/*.rb
+ # Extract helper names from files in app/helpers/**/*_helper.rb
def all_application_helpers
- extract = /^#{Regexp.quote(helpers_dir)}\/?(.*)_helper.rb$/
- Dir["#{helpers_dir}/**/*_helper.rb"].map { |file| file.sub extract, '\1' }
+ helpers = []
+ helpers_path.each do |path|
+ extract = /^#{Regexp.quote(path)}\/?(.*)_helper.rb$/
+ helpers += Dir["#{path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
+ end
+ helpers.sort!
+ helpers.uniq!
+ helpers
end
end
end
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb
index 7ea64c1923..f15c012471 100644
--- a/actionpack/lib/action_controller/railtie.rb
+++ b/actionpack/lib/action_controller/railtie.rb
@@ -3,7 +3,7 @@ require "rails"
module ActionController
class Railtie < Rails::Railtie
- plugin_name :action_controller
+ railtie_name :action_controller
require "action_controller/railties/subscriber"
subscriber ActionController::Railties::Subscriber.new
@@ -19,25 +19,8 @@ module ActionController
ActionController::Base.logger ||= Rails.logger
end
- # Routing must be initialized after plugins to allow the former to extend the routes
- initializer "action_controller.initialize_routing" do |app|
- app.route_configuration_files << app.config.routes_configuration_file
- app.route_configuration_files << app.config.builtin_routes_configuration_file
- end
-
initializer "action_controller.initialize_framework_caches" do
ActionController::Base.cache_store ||= RAILS_CACHE
end
-
- # Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
- # (but only for those frameworks that are to be loaded). If the framework's
- # paths have already been set, it is not changed, otherwise it is
- # set to use Configuration#view_path.
- initializer "action_controller.initialize_framework_views" do |app|
- # TODO: this should be combined with the logic for default config.action_controller.view_paths
- view_path = ActionView::PathSet.type_cast(app.config.view_path, app.config.cache_classes)
- ActionController::Base.view_paths = view_path if ActionController::Base.view_paths.blank?
- end
-
end
end