From e65c23dc3e775be3162de25548f3192939ff3da3 Mon Sep 17 00:00:00 2001
From: Prem Sichanugrist <s@sikachu.com>
Date: Sun, 21 Nov 2010 01:36:27 +0700
Subject: Mention the case that `render` will return nil if given `:collection`
 is nil or empty when rendering partial.

---
 actionpack/lib/action_view/partials.rb | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'actionpack')

diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb
index 844c3e9572..cd3f130dc4 100644
--- a/actionpack/lib/action_view/partials.rb
+++ b/actionpack/lib/action_view/partials.rb
@@ -75,6 +75,11 @@ module ActionView
   #
   #   <%= render :partial => "ad", :collection => @advertisements, :spacer_template => "ad_divider" %>
   #
+  # If the given <tt>:collection</tt> is nil or empty, <tt>render</tt> will return nil. This will allow you
+  # to specify a text which will displayed instead by using this form:
+  #
+  #   <%= render(:partial => "ad", :collection => @advertisements) || "There's no ad to be displayed" %>
+  #
   # NOTE: Due to backwards compatibility concerns, the collection can't be one of hashes. Normally you'd also
   # just keep domain objects, like Active Records, in there.
   #
-- 
cgit v1.2.3