Permalink
Browse files

Replace _action_view with view_context to reflect that it is public a…

…nd that it does not need to be an ActionView instance
  • Loading branch information...
1 parent f094540 commit af375a5eb3aba149590be1636480e1c3976c124f @wycats wycats committed Aug 6, 2009
@@ -13,7 +13,7 @@ class Kaigi < ActionController::Http
before_filter :set_name
append_view_path "views"
- def _action_view
+ def view_context
self
end
@@ -31,8 +31,8 @@ module Renderer
# partial<Boolean>:: Whether or not the template to render is a partial
#
# Override this method in a to change the default behavior.
- def _action_view
- @_action_view ||= ActionView::Base.for_controller(self)
+ def view_context
+ @_view_context ||= ActionView::Base.for_controller(self)
end
# Mostly abstracts the fact that calling render twice is a DoubleRenderError.
@@ -55,7 +55,7 @@ def render(*args)
def render_to_body(options = {})
# TODO: Refactor so we can just use the normal template logic for this
if options[:_partial_object]
- _action_view.render_partial(options)
+ view_context.render_partial(options)
else
_determine_template(options)
_render_template(options)
@@ -77,7 +77,7 @@ def render_to_string(options = {})
# _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)
- _action_view.render_template(options[:_template], options[:_layout], options, options[:_partial])
+ view_context.render_template(options[:_template], options[:_layout], options, options[:_partial])
end
# The list of view paths for this controller. See ActionView::ViewPathSet for
@@ -72,7 +72,7 @@ def assign_shortcuts(*) end
# TODO: Remove this after we flip
def template
- @template ||= _action_view
+ @template ||= view_context
end
def process_action(*)
@@ -141,7 +141,7 @@ def prepend_view_path(path)
end
def view_paths
- _action_view.view_paths
+ view_context.view_paths
end
end
end
@@ -85,7 +85,7 @@ module RJS
register_renderer :update
def _render_update(proc, options)
- generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(_action_view, &proc)
+ generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(view_context, &proc)
self.content_type = Mime::JS
self.response_body = generator.to_s
end
@@ -129,8 +129,7 @@ def cache_layout?
end
def content_for_layout(controller)
- # TODO: Remove this when new base is merged in
- template = controller.respond_to?(:template) ? controller.template : controller._action_view
+ template = controller.view_context
template.layout && template.instance_variable_get('@cached_content_for_layout')
end
end
@@ -78,7 +78,7 @@ class TestCase
def assert_template(options = {}, message = nil)
validate_request!
- hax = @controller._action_view.instance_variable_get(:@_rendered)
+ hax = @controller.view_context.instance_variable_get(:@_rendered)
case options
when NilClass, String

0 comments on commit af375a5

Please sign in to comment.