aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-04-04 21:06:26 -0700
committerwycats <wycats@gmail.com>2010-04-04 21:06:26 -0700
commit79d194e920a1b6e23cad9b6f3397da66b3938116 (patch)
treee1099a5b61d6d8fe16b0be225d455046543064cc /actionpack/lib
parentd61c76840ae333d668ba61b54611653aea1e4d66 (diff)
downloadrails-79d194e920a1b6e23cad9b6f3397da66b3938116.tar.gz
rails-79d194e920a1b6e23cad9b6f3397da66b3938116.tar.bz2
rails-79d194e920a1b6e23cad9b6f3397da66b3938116.zip
Make it easier to subclass AC::Metal with most, but not all, of the modules in AC::Base
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/base.rb88
1 files changed, 45 insertions, 43 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 5bd59d4a87..d2118ec483 100644
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -2,48 +2,59 @@ module ActionController
class Base < Metal
abstract!
- include AbstractController::Layouts
- include AbstractController::Translation
+ def self.modules_without(*modules)
+ modules = modules.map do |m|
+ m.is_a?(Symbol) ? ActionController.const_get(m) : m
+ end
- include ActionController::Helpers
+ MODULES - modules
+ end
- include ActionController::HideActions
- include ActionController::UrlFor
- include ActionController::Redirecting
- include ActionController::Rendering
- include ActionController::Renderers::All
- include ActionController::ConditionalGet
- include ActionController::RackDelegation
+ MODULES = [
+ AbstractController::Layouts,
+ AbstractController::Translation,
- # Legacy modules
- include SessionManagement
- include ActionController::Caching
- include ActionController::MimeResponds
- include ActionController::PolymorphicRoutes
+ Helpers,
+ HideActions,
+ UrlFor,
+ Redirecting,
+ Rendering,
+ Renderers::All,
+ ConditionalGet,
+ RackDelegation,
+ SessionManagement,
+ Caching,
+ MimeResponds,
+ PolymorphicRoutes,
+ ImplicitRender,
- # Rails 2.x compatibility
- include ActionController::Compatibility
- include ActionController::ImplicitRender
+ Cookies,
+ Flash,
+ Verification,
+ RequestForgeryProtection,
+ Streaming,
+ RecordIdentifier,
+ HttpAuthentication::Basic::ControllerMethods,
+ HttpAuthentication::Digest::ControllerMethods,
- include ActionController::Cookies
- include ActionController::Flash
- include ActionController::Verification
- include ActionController::RequestForgeryProtection
- include ActionController::Streaming
- include ActionController::RecordIdentifier
- include ActionController::HttpAuthentication::Basic::ControllerMethods
- include ActionController::HttpAuthentication::Digest::ControllerMethods
+ # Add instrumentations hooks at the bottom, to ensure they instrument
+ # all the methods properly.
+ Instrumentation,
- # Add instrumentations hooks at the bottom, to ensure they instrument
- # all the methods properly.
- include ActionController::Instrumentation
+ # Before callbacks should also be executed the earliest as possible, so
+ # also include them at the bottom.
+ AbstractController::Callbacks,
- # Before callbacks should also be executed the earliest as possible, so
- # also include them at the bottom.
- include AbstractController::Callbacks
+ # The same with rescue, append it at the end to wrap as much as possible.
+ Rescue
+ ]
- # The same with rescue, append it at the end to wrap as much as possible.
- include ActionController::Rescue
+ MODULES.each do |mod|
+ include mod
+ end
+
+ # Rails 2.x compatibility
+ include ActionController::Compatibility
def self.inherited(klass)
::ActionController::Base.subclasses << klass.to_s
@@ -55,15 +66,6 @@ module ActionController
@subclasses ||= []
end
- # This method has been moved to ActionDispatch::Request.filter_parameters
- def self.filter_parameter_logging(*args, &block)
- ActiveSupport::Deprecation.warn("Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead", caller)
- filter = Rails.application.config.filter_parameters
- filter.concat(args)
- filter << block if block
- filter
- end
-
ActiveSupport.run_load_hooks(:action_controller, self)
end
end