aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-12-31 01:45:56 +0100
committerYehuda Katz <wycats@Yehuda-Katz.local>2009-12-31 18:40:20 -0800
commitc03c40b481f433214ff68d1cae93df9e26190b42 (patch)
tree8d5b8ee06fbf1426aef436d3533132eaa6773c53
parent33c98b15bc8bea1366a721eae5fbfecf6c53c65d (diff)
downloadrails-c03c40b481f433214ff68d1cae93df9e26190b42.tar.gz
rails-c03c40b481f433214ff68d1cae93df9e26190b42.tar.bz2
rails-c03c40b481f433214ff68d1cae93df9e26190b42.zip
Expose a _render_partial hook as thhe _render_template one and make use of it.
-rw-r--r--actionmailer/lib/action_mailer/base.rb1
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb14
-rw-r--r--actionpack/lib/action_controller/metal/rendering.rb12
3 files changed, 16 insertions, 11 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 0d59850f7f..0248e29cb7 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -254,6 +254,7 @@ module ActionMailer #:nodoc:
include Quoting
extend AdvAttrAccessor
+ include AbstractController::Logger
include AbstractController::Rendering
include AbstractController::LocalizedCache
include AbstractController::Layouts
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 64a8a5f241..332d86b089 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -1,5 +1,4 @@
require "abstract_controller/base"
-require "abstract_controller/logger"
module AbstractController
class DoubleRenderError < Error
@@ -13,8 +12,6 @@ module AbstractController
module Rendering
extend ActiveSupport::Concern
- include AbstractController::Logger
-
included do
extlib_inheritable_accessor :_view_paths
self._view_paths ||= ActionView::PathSet.new
@@ -67,7 +64,7 @@ module AbstractController
def render_to_body(options = {})
# TODO: Refactor so we can just use the normal template logic for this
if options.key?(:partial)
- view_context.render_partial(options)
+ _render_partial(options)
else
_determine_template(options)
_render_template(options)
@@ -87,11 +84,18 @@ module AbstractController
# ==== Options
# _template<ActionView::Template>:: The template to render
# _layout<ActionView::Template>:: The layout to wrap the template in (optional)
- # _partial<TrueClass, FalseClass>:: Whether or not the template to be rendered is a partial
def _render_template(options)
view_context.render_template(options)
end
+ # Renders the given partial.
+ #
+ # ==== Options
+ # partial<String|Object>:: The partial name or the object to be rendered
+ def _render_partial(options)
+ view_context.render_partial(options)
+ end
+
# The list of view paths for this controller. See ActionView::ViewPathSet for
# more details about writing custom view paths.
def view_paths
diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb
index 20eb524e50..74e50bb032 100644
--- a/actionpack/lib/action_controller/metal/rendering.rb
+++ b/actionpack/lib/action_controller/metal/rendering.rb
@@ -20,12 +20,6 @@ module ActionController
def render_to_body(options)
_process_options(options)
-
- if options.key?(:partial)
- options[:partial] = action_name if options[:partial] == true
- options[:_details] = {:formats => formats}
- end
-
super
end
@@ -43,6 +37,12 @@ module ActionController
super
end
+ def _render_partial(options)
+ options[:partial] = action_name if options[:partial] == true
+ options[:_details] = {:formats => formats}
+ super
+ end
+
def format_for_text
formats.first
end