Skip to content

Commit

Permalink
Some more AV refactoring:
Browse files Browse the repository at this point in the history
  * 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
  • Loading branch information
wycats committed Aug 7, 2009
1 parent 8534c5b commit b3e199f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
13 changes: 2 additions & 11 deletions actionpack/lib/action_view/render/partials.rb
Expand Up @@ -229,19 +229,10 @@ def _render_partial_with_block(layout, block, options)

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)
Expand Down
8 changes: 4 additions & 4 deletions actionpack/lib/action_view/render/rendering.rb
Expand Up @@ -40,7 +40,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
end
end

def _render_content_with_layout(content, layout, locals)
def _render_content(content, layout, locals)
return content unless layout

locals ||= {}
Expand Down Expand Up @@ -116,11 +116,11 @@ 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, {})
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.
Expand All @@ -146,7 +146,7 @@ def _render_template_with_layout(template, layout = nil, options = {}, partial =
_render_template(template, locals)
end

layout ? _render_content_with_layout(content, layout, locals) : content
_render_content(content, layout, locals)
end
end
end

0 comments on commit b3e199f

Please sign in to comment.