From 4bae77a89baf0fee15c6b2cfd3987f7344b56a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 8 Mar 2010 02:58:16 +0100 Subject: More cleanup on the layouts side. --- actionpack/lib/action_view/render/partials.rb | 13 ++----------- actionpack/lib/action_view/render/rendering.rb | 10 ++++------ 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 52cb188508..eecc88a1e0 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -182,9 +182,6 @@ module ActionView @view = view_context @partial_names = PARTIAL_NAMES[@view.controller.class] - key = Thread.current[:format_locale_key] - @templates = TEMPLATES[key] if key - setup(options, block) end @@ -296,15 +293,9 @@ module ActionView end end - def find_template(path = @path) - unless @templates - path && _find_template(path) - else - path && @templates[path] ||= _find_template(path) - end - end + def find_template(path=@path) + return path unless path.is_a?(String) - def _find_template(path) if controller = @view.controller prefix = controller.controller_path unless path.include?(?/) end diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index b92a03ddbd..17fb110eb4 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -34,7 +34,6 @@ module ActionView end if template - layout = find(layout) if layout _render_template(template, layout, :locals => options[:locals]) end when :update @@ -92,13 +91,12 @@ module ActionView _render_template(template, layout, options) end - def _find_layout(template, layout) + def _find_layout(layout) begin - prefix = "layouts" unless layout =~ /\blayouts/ - layout = find(layout, prefix) + find(layout) rescue ActionView::MissingTemplate => e update_details(:formats => nil) do - raise unless template_lookup.exists?(layout, prefix) + raise unless template_lookup.exists?(layout) end end end @@ -107,7 +105,7 @@ module ActionView self.formats = template.details[:formats] locals = options[:locals] || {} - layout = _find_layout(template, layout) if layout.is_a?(String) + layout = _find_layout(layout) if layout ActiveSupport::Notifications.instrument("action_view.render_template", :identifier => template.identifier, :layout => layout.try(:identifier)) do -- cgit v1.2.3