aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb2
-rw-r--r--actionpack/lib/action_controller/railtie.rb17
-rw-r--r--actionpack/lib/action_dispatch/middleware/callbacks.rb2
-rw-r--r--actionpack/lib/action_dispatch/railtie.rb16
4 files changed, 7 insertions, 30 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index cdd14560e1..24f8cb8a57 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -51,6 +51,8 @@ module ActionController
included do
# Set the default directory for helpers
+ # TODO This should support multiple directories in order
+ # to work with engines
extlib_inheritable_accessor(:helpers_dir) do
defined?(Rails.root) ? "#{Rails.root}/app/helpers" : "app/helpers"
end
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb
index 7ea64c1923..6b270d1136 100644
--- a/actionpack/lib/action_controller/railtie.rb
+++ b/actionpack/lib/action_controller/railtie.rb
@@ -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
diff --git a/actionpack/lib/action_dispatch/middleware/callbacks.rb b/actionpack/lib/action_dispatch/middleware/callbacks.rb
index d07841218a..7cf75ffe63 100644
--- a/actionpack/lib/action_dispatch/middleware/callbacks.rb
+++ b/actionpack/lib/action_dispatch/middleware/callbacks.rb
@@ -37,7 +37,7 @@ module ActionDispatch
def initialize(app, prepare_each_request = false)
@app, @prepare_each_request = app, prepare_each_request
- run_callbacks(:prepare)
+ run_callbacks(:prepare) unless @prepare_each_request
end
def call(env)
diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb
index e4bd143e78..bd15ca9b3b 100644
--- a/actionpack/lib/action_dispatch/railtie.rb
+++ b/actionpack/lib/action_dispatch/railtie.rb
@@ -5,22 +5,14 @@ module ActionDispatch
class Railtie < Rails::Railtie
plugin_name :action_dispatch
+ # Initialize route files to an array
+ config.action_dispatch.route_files = []
+
# Prepare dispatcher callbacks and run 'prepare' callbacks
initializer "action_dispatch.prepare_dispatcher" do |app|
# TODO: This used to say unless defined?(Dispatcher). Find out why and fix.
require 'rails/dispatcher'
-
- unless app.config.cache_classes
- # Setup dev mode route reloading
- routes_last_modified = app.routes_changed_at
- reload_routes = lambda do
- unless app.routes_changed_at == routes_last_modified
- routes_last_modified = app.routes_changed_at
- app.reload_routes!
- end
- end
- ActionDispatch::Callbacks.before { |callbacks| reload_routes.call }
- end
+ ActionDispatch::Callbacks.to_prepare { app.routes_reloader.reload_if_changed }
end
end
end \ No newline at end of file