aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract/renderer.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-05-15 16:47:15 +0200
committerPratik Naik <pratiknaik@gmail.com>2009-05-15 16:47:15 +0200
commit59653101b8cef7915cb1fb4ad4b84f49ae0881e5 (patch)
tree9dacd7eaa05c7957b14389538a30d7ebf7f7e349 /actionpack/lib/action_controller/abstract/renderer.rb
parent26ad104e72e2b758815a043341dd83a1b02e8c7f (diff)
parenteb021707f53be46140b55a48e5ef03ed0577a45c (diff)
downloadrails-59653101b8cef7915cb1fb4ad4b84f49ae0881e5.tar.gz
rails-59653101b8cef7915cb1fb4ad4b84f49ae0881e5.tar.bz2
rails-59653101b8cef7915cb1fb4ad4b84f49ae0881e5.zip
Merge commit 'mainstream/master'
Conflicts: actionpack/lib/action_view/helpers/form_helper.rb
Diffstat (limited to 'actionpack/lib/action_controller/abstract/renderer.rb')
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb35
1 files changed, 24 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index e31accbbfc..f2044a35ec 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -2,22 +2,28 @@ require "action_controller/abstract/logger"
module AbstractController
module Renderer
+ extend ActiveSupport::DependencyModule
+
depends_on AbstractController::Logger
-
- setup do
+
+ included do
attr_internal :formats
-
+
extlib_inheritable_accessor :_view_paths
-
+
self._view_paths ||= ActionView::PathSet.new
end
-
+
def _action_view
@_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self)
end
- def render(options = {})
- self.response_body = render_to_body(options)
+ def render(*args)
+ if response_body
+ raise AbstractController::DoubleRenderError, "OMG"
+ end
+
+ self.response_body = render_to_body(*args)
end
# Raw rendering of a template to a Rack-compatible body.
@@ -28,9 +34,16 @@ module AbstractController
# :api: plugin
def render_to_body(options = {})
name = options[:_template_name] || action_name
-
- template = options[:_template] || view_paths.find_by_parts(name.to_s, {:formats => formats}, options[:_prefix])
- _render_template(template, options)
+
+ # TODO: Refactor so we can just use the normal template logic for this
+ if options[:_partial_object]
+ _action_view._render_partial_from_controller(options)
+ else
+ options[:_template] ||= view_paths.find_by_parts(name.to_s, {:formats => formats},
+ options[:_prefix], options[:_partial])
+
+ _render_template(options[:_template], options)
+ end
end
# Raw rendering of a template to a string.
@@ -44,7 +57,7 @@ module AbstractController
end
def _render_template(template, options)
- _action_view._render_template_with_layout(template)
+ _action_view._render_template_from_controller(template, nil, options, options[:_partial])
end
def view_paths() _view_paths end