diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-26 18:47:55 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-26 18:47:55 +0100 |
commit | 395d6648ce7549f71dd0a76dc061e87f608aaaab (patch) | |
tree | 4dbb6eb54ff784143bf6e2f671057f0b8162dba5 /actionpack | |
parent | fc266d7ec2cf1d3f9daf585ea6b79b61467a175f (diff) | |
download | rails-395d6648ce7549f71dd0a76dc061e87f608aaaab.tar.gz rails-395d6648ce7549f71dd0a76dc061e87f608aaaab.tar.bz2 rails-395d6648ce7549f71dd0a76dc061e87f608aaaab.zip |
Move application configuration to the application configuration object, remove railtie_name and engine_name and allow to set the configuration object.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railties/url_helpers.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/railtie.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_view/base.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/railtie.rb | 12 |
6 files changed, 22 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index ad2b68af21..5797282b41 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -19,6 +19,7 @@ module ActionController include SessionManagement include ActionController::Caching include ActionController::MimeResponds + include ActionController::PolymorphicRoutes # Rails 2.x compatibility include ActionController::Compatibility diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index 2626a31fc2..0ec89928af 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -1,16 +1,17 @@ require "rails" require "action_controller" +require "action_dispatch/railtie" require "action_view/railtie" require "active_support/core_ext/class/subclasses" require "active_support/deprecation/proxy_wrappers" require "active_support/deprecation" +require "action_controller/railties/log_subscriber" +require "action_controller/railties/url_helpers" + module ActionController class Railtie < Rails::Railtie - railtie_name :action_controller - - require "action_controller/railties/log_subscriber" - require "action_controller/railties/url_helpers" + config.action_controller = ActiveSupport::OrderedOptions.new ad = config.action_dispatch config.action_controller.singleton_class.send(:define_method, :session) do @@ -37,7 +38,7 @@ module ActionController ad.session_store = val end - log_subscriber ActionController::Railties::LogSubscriber.new + log_subscriber :action_controller, ActionController::Railties::LogSubscriber.new initializer "action_controller.logger" do ActionController.base_hook { self.logger ||= Rails.logger } @@ -69,7 +70,7 @@ module ActionController initializer "action_controller.url_helpers" do |app| ActionController.base_hook do - extend ::ActionController::Railtie::UrlHelpers.with(app.routes) + extend ::ActionController::Railties::UrlHelpers.with(app.routes) end message = "ActionController::Routing::Routes is deprecated. " \ diff --git a/actionpack/lib/action_controller/railties/url_helpers.rb b/actionpack/lib/action_controller/railties/url_helpers.rb index ad2a8d4ef3..5f95e1c621 100644 --- a/actionpack/lib/action_controller/railties/url_helpers.rb +++ b/actionpack/lib/action_controller/railties/url_helpers.rb @@ -1,5 +1,5 @@ module ActionController - class Railtie + module Railties module UrlHelpers def self.with(router) Module.new do diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index e486bd4079..430c90e515 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -3,8 +3,7 @@ require "rails" module ActionDispatch class Railtie < Rails::Railtie - railtie_name :action_dispatch - + config.action_dispatch = ActiveSupport::OrderedOptions.new config.action_dispatch.x_sendfile_header = "X-Sendfile" config.action_dispatch.ip_spoofing_check = true diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 9eec8ecce8..919b1e3470 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -159,8 +159,6 @@ module ActionView #:nodoc: include Helpers, Rendering, Partials, Layouts, ::ERB::Util, Context extend ActiveSupport::Memoizable - ActionView.run_base_hooks(self) - # Specify whether RJS responses should be wrapped in a try/catch block # that alert()s the caught exception (and then re-raises it). cattr_accessor :debug_rjs @@ -175,6 +173,8 @@ module ActionView #:nodoc: delegate :logger, :to => 'ActionController::Base', :allow_nil => true end + ActionView.run_base_hooks(self) + attr_accessor :base_path, :assigns, :template_extension, :lookup_context attr_internal :captures, :request, :controller, :template, :config diff --git a/actionpack/lib/action_view/railtie.rb b/actionpack/lib/action_view/railtie.rb index 2e5d115630..9cf007cd2b 100644 --- a/actionpack/lib/action_view/railtie.rb +++ b/actionpack/lib/action_view/railtie.rb @@ -3,10 +3,10 @@ require "rails" module ActionView class Railtie < Rails::Railtie - railtie_name :action_view + config.action_view = ActiveSupport::OrderedOptions.new require "action_view/railties/log_subscriber" - log_subscriber ActionView::Railties::LogSubscriber.new + log_subscriber :action_view, ActionView::Railties::LogSubscriber.new initializer "action_view.cache_asset_timestamps" do |app| unless app.config.cache_classes @@ -15,5 +15,13 @@ module ActionView end end end + + initializer "action_view.set_configs" do |app| + ActionView.base_hook do + app.config.action_view.each do |k,v| + send "#{k}=", v + end + end + end end end
\ No newline at end of file |