aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-08-07 02:46:21 -0300
committerYehuda Katz <wycats@gmail.com>2009-08-07 02:46:21 -0300
commitb3e199f6981b2fbf062fe668ff93b7dc56e98a38 (patch)
treeb683fcefb279ebff096ef23e4579e788f88565ea
parent8534c5bf193c6a234d55116d520a54a1b634a93e (diff)
downloadrails-b3e199f6981b2fbf062fe668ff93b7dc56e98a38.tar.gz
rails-b3e199f6981b2fbf062fe668ff93b7dc56e98a38.tar.bz2
rails-b3e199f6981b2fbf062fe668ff93b7dc56e98a38.zip
Some more AV refactoring:
* remove no longer used _array_like_objects * _render_content_with_layout renamed to _render_content since layout it optional * remove check for optional layout before _render_content
-rw-r--r--actionpack/lib/action_view/render/partials.rb13
-rw-r--r--actionpack/lib/action_view/render/rendering.rb8
2 files changed, 6 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb
index 89d954037b..7a791d03ce 100644
--- a/actionpack/lib/action_view/render/partials.rb
+++ b/actionpack/lib/action_view/render/partials.rb
@@ -229,19 +229,10 @@ module ActionView
def _render_partial_with_layout(layout, options)
if layout
- prefix = controller && !layout.include?("/") ? controller.controller_path : nil
+ prefix = layout.include?(?/) ? nil : controller_path
layout = find_by_parts(layout, {:formats => formats}, prefix, true)
end
- content = _render_partial(options)
- return _render_content_with_layout(content, layout, options[:locals])
- end
-
- def _array_like_objects
- array_like = [Array]
- if defined?(ActiveRecord)
- array_like.push(ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope)
- end
- array_like
+ _render_content(_render_partial(options), layout, options[:locals])
end
def _render_partial_object(template, options)
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb
index 32c30e8f68..527cef97c7 100644
--- a/actionpack/lib/action_view/render/rendering.rb
+++ b/actionpack/lib/action_view/render/rendering.rb
@@ -40,7 +40,7 @@ module ActionView
end
end
- def _render_content_with_layout(content, layout, locals)
+ def _render_content(content, layout, locals)
return content unless layout
locals ||= {}
@@ -116,11 +116,11 @@ module ActionView
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
+ layout ? _render_content(content, layout, options[:locals]) : content
end
def _render_text(text, layout, options)
- layout ? _render_content_with_layout(text, layout, options[:locals]) : text
+ layout ? _render_content(text, layout, options[:locals]) : text
end
# This is the API to render a ViewContext's template from a controller.
@@ -146,7 +146,7 @@ module ActionView
_render_template(template, locals)
end
- layout ? _render_content_with_layout(content, layout, locals) : content
+ _render_content(content, layout, locals)
end
end
end \ No newline at end of file