aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2010-11-21 01:36:27 +0700
committerPrem Sichanugrist <s@sikachu.com>2010-11-21 01:36:27 +0700
commit3ddbaf955e45eed15662e2f141b75dc0df63c1b0 (patch)
tree500c7c412f46750a1f08256f92b1d289a1a7e17e /actionpack
parent5b86e8f5e9fbc55a04d72113035054c35a400507 (diff)
downloadrails-3ddbaf955e45eed15662e2f141b75dc0df63c1b0.tar.gz
rails-3ddbaf955e45eed15662e2f141b75dc0df63c1b0.tar.bz2
rails-3ddbaf955e45eed15662e2f141b75dc0df63c1b0.zip
Mention the case that `render` will return nil if given `:collection` is nil or empty when rendering partial.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/partials.rb5
1 files changed, 5 insertions, 0 deletions
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.
#