diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-02 23:00:59 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-02 23:00:59 +0530 |
commit | eeda8403fd222c1109618834e4fe31a45e6531ca (patch) | |
tree | 3938573377fdbcd0a956408f8bc8363adec1713a /railties/guides/source/layouts_and_rendering.textile | |
parent | 67790644372ad3a771810f1d6d99687d795789ea (diff) | |
parent | 44284a613b3efe2319db3f84090c0004505942c1 (diff) | |
download | rails-eeda8403fd222c1109618834e4fe31a45e6531ca.tar.gz rails-eeda8403fd222c1109618834e4fe31a45e6531ca.tar.bz2 rails-eeda8403fd222c1109618834e4fe31a45e6531ca.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/layouts_and_rendering.textile')
-rw-r--r-- | railties/guides/source/layouts_and_rendering.textile | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index 310a70ca9b..3252f17c56 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -1093,6 +1093,13 @@ In Rails 3.0, there is also a shorthand for this. Assuming +@products+ is a coll Rails determines the name of the partial to use by looking at the model name in the collection. In fact, you can even create a heterogeneous collection and render it this way, and Rails will choose the proper partial for each member of the collection: +In the event that the collection is empty, +render+ will return nil, so it should be fairly simple to provide alternative content. + +<erb> +<h1>Products</h1> +<%= render(@products) || 'There are no products available.' %> +</erb> + * +index.html.erb+ <erb> |