aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/new_base/base.rb')
-rw-r--r--actionpack/lib/action_controller/new_base/base.rb50
1 files changed, 39 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb
index 756a0799fe..ffe608ade4 100644
--- a/actionpack/lib/action_controller/new_base/base.rb
+++ b/actionpack/lib/action_controller/new_base/base.rb
@@ -4,40 +4,54 @@ module ActionController
include AbstractController::Benchmarker
include AbstractController::Callbacks
- include AbstractController::Helpers
include AbstractController::Logger
-
+
+ include ActionController::Helpers
include ActionController::HideActions
include ActionController::UrlFor
include ActionController::Redirector
include ActionController::Renderer
+ include ActionController::Renderers::All
include ActionController::Layouts
include ActionController::ConditionalGet
# Legacy modules
include SessionManagement
include ActionDispatch::StatusCodes
+ include ActionController::Caching
+ include ActionController::MimeResponds
# Rails 2.x compatibility
include ActionController::Rails2Compatibility
+ include ActionController::Cookies
+ include ActionController::Session
+ include ActionController::Flash
+ include ActionController::Verification
+ include ActionController::RequestForgeryProtection
+ include ActionController::Streaming
+ include ActionController::HttpAuthentication::Basic::ControllerMethods
+ include ActionController::HttpAuthentication::Digest::ControllerMethods
+ include ActionController::FilterParameterLogging
+ include ActionController::Translation
+
# TODO: Extract into its own module
# This should be moved together with other normalizing behavior
module ImplicitRender
def process_action(method_name)
ret = super
- render if response_body.nil?
+ default_render if response_body.nil?
ret
end
- def _implicit_render
+ def default_render
render
end
def method_for_action(action_name)
super || begin
if view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path)
- "_implicit_render"
+ "default_render"
end
end
end
@@ -62,7 +76,7 @@ module ActionController
end
end
- def render_to_body(action = nil, options = {})
+ def _normalize_options(action = nil, options = {}, &blk)
if action.is_a?(Hash)
options, action = action, nil
elsif action.is_a?(String) || action.is_a?(Symbol)
@@ -79,11 +93,25 @@ module ActionController
if options.key?(:action) && options[:action].to_s.index("/")
options[:template] = options.delete(:action)
end
-
- # options = {:template => options.to_s} if options.is_a?(String) || options.is_a?(Symbol)
- super(options) || " "
+
+ if options[:status]
+ options[:status] = interpret_status(options[:status]).to_i
+ end
+
+ options[:update] = blk if block_given?
+ options
end
-
+
+ def render(action = nil, options = {}, &blk)
+ options = _normalize_options(action, options, &blk)
+ super(options)
+ end
+
+ def render_to_string(action = nil, options = {}, &blk)
+ options = _normalize_options(action, options, &blk)
+ super(options)
+ end
+
# Redirects the browser to the target specified in +options+. This parameter can take one of three forms:
#
# * <tt>Hash</tt> - The URL will be generated by calling url_for with the +options+.
@@ -141,4 +169,4 @@ module ActionController
super(url, status)
end
end
-end \ No newline at end of file
+end