<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -939,8 +939,7 @@ module ActionController #:nodoc:
             render_for_text(generator.to_s, options[:status])
 
           elsif options[:nothing]
-            # Safari doesn't pass the headers of the return if the response is zero length
-            render_for_text(&quot; &quot;, options[:status])
+            render_for_text(nil, options[:status])
 
           else
             render_for_file(default_template_name, options[:status], true)
@@ -1154,7 +1153,11 @@ module ActionController #:nodoc:
           response.body ||= ''
           response.body &lt;&lt; text.to_s
         else
-          response.body = text.is_a?(Proc) ? text : text.to_s
+          response.body = case text
+            when Proc then text
+            when nil  then &quot; &quot; # Safari doesn't pass the headers of the return if the response is zero length
+            else           text.to_s
+          end
         end
       end
 </diff>
      <filename>actionpack/lib/action_controller/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -263,7 +263,7 @@ module ActionView #:nodoc:
           end
         elsif options[:file]
           render_file(options[:file], nil, options[:locals])
-        elsif options[:partial] &amp;&amp; options[:collection]
+        elsif options[:partial] &amp;&amp; options.has_key?(:collection)
           render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals], options[:as])
         elsif options[:partial]
           render_partial(options[:partial], options[:object], options[:locals])</diff>
      <filename>actionpack/lib/action_view/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -161,7 +161,7 @@ module ActionView
       end
 
       def render_partial_collection(partial_path, collection, partial_spacer_template = nil, local_assigns = {}, as = nil) #:nodoc:
-        return &quot; &quot; if collection.empty?
+        return nil if collection.blank?
 
         local_assigns = local_assigns ? local_assigns.clone : {}
         spacer = partial_spacer_template ? render(:partial =&gt; partial_spacer_template) : ''</diff>
      <filename>actionpack/lib/action_view/partials.rb</filename>
    </modified>
    <modified>
      <diff>@@ -329,7 +329,7 @@ class RenderTest &lt; Test::Unit::TestCase
   def test_render_text_with_nil
     get :render_text_with_nil
     assert_response 200
-    assert_equal '', @response.body
+    assert_equal ' ', @response.body
   end
 
   def test_render_text_with_false</diff>
      <filename>actionpack/test/controller/render_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -87,6 +87,14 @@ class ViewRenderTest &lt; Test::Unit::TestCase
       @view.render(:partial =&gt; &quot;test/local_inspector&quot;, :collection =&gt; [ Customer.new(&quot;mary&quot;) ])
   end
 
+  def test_render_partial_with_empty_collection_should_return_nil
+    assert_nil @view.render(:partial =&gt; &quot;test/customer&quot;, :collection =&gt; [])
+  end
+
+  def test_render_partial_with_nil_collection_should_return_nil
+    assert_nil @view.render(:partial =&gt; &quot;test/customer&quot;, :collection =&gt; nil)
+  end
+
   # TODO: The reason for this test is unclear, improve documentation
   def test_render_partial_and_fallback_to_layout
     assert_equal &quot;Before (Josh)\n\nAfter&quot;, @view.render(:partial =&gt; &quot;test/layout_for_partial&quot;, :locals =&gt; { :name =&gt; &quot;Josh&quot; })</diff>
      <filename>actionpack/test/template/render_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>71c4ff07ab4313c1f4781d59ad2f4528f5875665</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Bates</name>
    <email>ryan@railscasts.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/a8ece12fe2ac7838407954453e0d31af6186a5db</url>
  <id>a8ece12fe2ac7838407954453e0d31af6186a5db</id>
  <committed-date>2008-08-19T17:09:04-07:00</committed-date>
  <authored-date>2008-08-19T17:09:04-07:00</authored-date>
  <message>Return nil instead of a space when passing an empty collection or nil to 'render :partial' [#791 state:resolved]

Signed-off-by: Joshua Peek &lt;josh@joshpeek.com&gt;</message>
  <tree>5a6cb0a957bebc1da95c1918563db10447cacd26</tree>
  <committer>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
