aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2014-02-09 23:51:46 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2014-02-09 23:51:46 +0530
commitccd908f9ce4d1eef786a16c79d45af552cb9fe2b (patch)
tree139ac6bf4a4d8f94374c14e7d9a70bab986fceb0 /guides
parent8b5d08aca293fd46a1099c406bed54a2c22d952a (diff)
parent6c252b5cb9efaf291359275e106116c7746d8915 (diff)
downloadrails-ccd908f9ce4d1eef786a16c79d45af552cb9fe2b.tar.gz
rails-ccd908f9ce4d1eef786a16c79d45af552cb9fe2b.tar.bz2
rails-ccd908f9ce4d1eef786a16c79d45af552cb9fe2b.zip
Merge pull request #13630 from seapy/master
Fixed typo [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/layouts_and_rendering.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md
index c72b584ed6..0cb213521c 100644
--- a/guides/source/layouts_and_rendering.md
+++ b/guides/source/layouts_and_rendering.md
@@ -1119,11 +1119,11 @@ With this change, you can access an instance of the `@products` collection as th
You can also pass in arbitrary local variables to any partial you are rendering with the `locals: {}` option:
```erb
-<%= render partial: "products", collection: @products,
+<%= render partial: "product", collection: @products,
as: :item, locals: {title: "Products Page"} %>
```
-Would render a partial `_products.html.erb` once for each instance of `product` in the `@products` instance variable passing the instance to the partial as a local variable called `item` and to each partial, make the local variable `title` available with the value `Products Page`.
+Would render a partial `_product.html.erb` once for each instance of `product` in the `@products` instance variable passing the instance to the partial as a local variable called `item` and to each partial, make the local variable `title` available with the value `Products Page`.
TIP: Rails also makes a counter variable available within a partial called by the collection, named after the member of the collection followed by `_counter`. For example, if you're rendering `@products`, within the partial you can refer to `product_counter` to tell you how many times the partial has been rendered. This does not work in conjunction with the `as: :value` option.