diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-06-01 09:38:09 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-06-01 09:38:09 +0100 |
commit | 9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78 (patch) | |
tree | 5a711cacac76a83ad12551023da8524f94e7365b /actionpack/lib/action_controller/abstract/renderer.rb | |
parent | dc7323efd34327c13d26031b68e51314c24360f6 (diff) | |
parent | 9537fd0e3a7625afe4bee75d749647ca1837195a (diff) | |
download | rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.gz rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.tar.bz2 rails-9d60525b5fc14b4b6f3ed9ba8ea874d6e76b4f78.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/lib/action_controller/abstract/renderer.rb')
-rw-r--r-- | actionpack/lib/action_controller/abstract/renderer.rb | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb index d7c68549e1..dd58c7cb64 100644 --- a/actionpack/lib/action_controller/abstract/renderer.rb +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -2,9 +2,9 @@ require "action_controller/abstract/logger" module AbstractController module Renderer - extend ActiveSupport::DependencyModule + extend ActiveSupport::Concern - depends_on AbstractController::Logger + include AbstractController::Logger included do attr_internal :formats @@ -15,22 +15,22 @@ module AbstractController end def _action_view - @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self) + @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self) end - + 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. # ==== # @option _prefix<String> The template's path prefix # @option _layout<String> The relative path to the layout template to use - # + # # :api: plugin def render_to_body(options = {}) # TODO: Refactor so we can just use the normal template logic for this @@ -46,7 +46,7 @@ module AbstractController # ==== # @option _prefix<String> The template's path prefix # @option _layout<String> The relative path to the layout template to use - # + # # :api: plugin def render_to_string(options = {}) AbstractController::Renderer.body_to_s(render_to_body(options)) @@ -55,8 +55,10 @@ module AbstractController def _render_template(options) _action_view._render_template_from_controller(options[:_template], options[:_layout], options, options[:_partial]) end - - def view_paths() _view_paths end + + def view_paths() + _view_paths + end # Return a string representation of a Rack-compatible response body. def self.body_to_s(body) @@ -71,7 +73,6 @@ module AbstractController end private - def _determine_template(options) name = (options[:_template_name] || action_name).to_s @@ -81,15 +82,18 @@ module AbstractController end module ClassMethods - def append_view_path(path) self.view_paths << path end - + + def prepend_view_path(path) + self.view_paths.unshift(path) + end + def view_paths self._view_paths end - + def view_paths=(paths) self._view_paths = paths.is_a?(ActionView::PathSet) ? paths : ActionView::Base.process_view_paths(paths) |