Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Dont introspect inline templates for the logger and cleanup a few sty…

…ling issues
  • Loading branch information...
commit a110ff0fca45c6cc74c0da5d8dcdabeed43e78b1 1 parent 36624b2
David Heinemeier Hansson dhh authored
9 actionpack/lib/abstract_controller/rendering.rb
View
@@ -125,8 +125,8 @@ def _determine_template(options)
if options.key?(:text)
options[:_template] = ActionView::Template::Text.new(options[:text], format_for_text)
elsif options.key?(:inline)
- handler = ActionView::Template.handler_class_for_extension(options[:type] || "erb")
- template = ActionView::Template.new(options[:inline], "inline #{options[:inline].inspect}", handler, {})
+ handler = ActionView::Template.handler_class_for_extension(options[:type] || "erb")
+ template = ActionView::Template.new(options[:inline], "inline template", handler, {})
options[:_template] = template
elsif options.key?(:template)
options[:_template_name] = options[:template]
@@ -194,9 +194,8 @@ def view_paths
# otherwise, process the parameter into a ViewPathSet.
def view_paths=(paths)
clear_template_caches!
- self._view_paths = paths.is_a?(ActionView::PathSet) ?
- paths : ActionView::Base.process_view_paths(paths)
+ self._view_paths = paths.is_a?(ActionView::PathSet) ? paths : ActionView::Base.process_view_paths(paths)
end
end
end
-end
+end
22 actionpack/lib/action_view/render/rendering.rb
View
@@ -78,12 +78,12 @@ def _layout_for(name = nil, &block)
end
def _render_inline(inline, layout, options)
- handler = Template.handler_class_for_extension(options[:type] || "erb")
- template = Template.new(options[:inline],
- "inline #{options[:inline].inspect}", handler, {})
+ handler = Template.handler_class_for_extension(options[:type] || "erb")
+ template = Template.new(options[:inline], "inline template", handler, {})
- locals = options[:locals]
+ locals = options[:locals]
content = template.render(self, locals)
+
_render_text(content, layout, locals)
end
@@ -91,6 +91,7 @@ def _render_text(content, layout, locals)
content = layout.render(self, locals) do |*name|
_layout_for(*name) { content }
end if layout
+
content
end
@@ -113,21 +114,16 @@ def _render_template(template, layout = nil, options = {}, partial = nil)
msg
end
- locals = options[:locals] || {}
-
- content = if partial
- _render_partial_object(template, options)
- else
- template.render(self, locals)
- end
-
+ locals = options[:locals] || {}
+ content = partial ? _render_partial_object(template, options) : template.render(self, locals)
@_content_for[:layout] = content
if layout
@_layout = layout.identifier
logger.info("Rendering template within #{layout.inspect}") if logger
- content = layout.render(self, locals) {|*name| _layout_for(*name) }
+ content = layout.render(self, locals) { |*name| _layout_for(*name) }
end
+
content
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.