diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-23 15:58:38 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-27 11:49:11 -0700 |
commit | cecafc52ee0a4a53c903ddbaba95683261f88e5f (patch) | |
tree | 4cc1f0d246a313b2a2fa78747b3265bdbd901c22 /actionpack/lib/action_view/render | |
parent | da3c21ead59cb47b8f4c69c6bd95f225a9c8b479 (diff) | |
download | rails-cecafc52ee0a4a53c903ddbaba95683261f88e5f.tar.gz rails-cecafc52ee0a4a53c903ddbaba95683261f88e5f.tar.bz2 rails-cecafc52ee0a4a53c903ddbaba95683261f88e5f.zip |
Refactor ActionView::Template
ActionView::Template is now completely independent from template
storage, which allows different back ends such as the database.
ActionView::Template's only responsibility is to take in the
template source (passed in from ActionView::Path), compile it,
and render it.
Diffstat (limited to 'actionpack/lib/action_view/render')
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 4213b09e48..f174053b86 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -46,8 +46,8 @@ module ActionView locals ||= {} if controller && layout - response.layout = layout.path_without_format_and_extension if controller.respond_to?(:response) - logger.info("Rendering template within #{layout.path_without_format_and_extension}") if logger + response.layout = layout.identifier if controller.respond_to?(:response) + logger.info("Rendering template within #{layout.identifier}") if logger end begin @@ -76,7 +76,6 @@ module ActionView end end rescue Exception => e - raise e if template.is_a?(InlineTemplate) || !template.filename if TemplateError === e e.sub_template_of(template) raise e @@ -86,7 +85,9 @@ module ActionView end def _render_inline(inline, layout, options) - content = _render_template(InlineTemplate.new(options[:inline], options[:type]), options[:locals] || {}) + handler = Template.handler_class_for_extension(options[:type] || "erb") + template = Template.new(options[:inline], "inline #{options[:inline].inspect}", handler, {}) + content = _render_template(template, options[:locals] || {}) layout ? _render_content_with_layout(content, layout, options[:locals]) : content end @@ -96,7 +97,7 @@ module ActionView def _render_template_with_layout(template, layout = nil, options = {}, partial = false) if controller && logger - logger.info("Rendering #{template.path_without_extension}" + + logger.info("Rendering #{template.identifier}" + (options[:status] ? " (#{options[:status]})" : '')) end @@ -107,7 +108,7 @@ module ActionView _render_template(template, options[:locals] || {}) end - return content unless layout && !template.exempt_from_layout? + return content unless layout _render_content_with_layout(content, layout, options[:locals] || {}) end end |