diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2014-02-09 23:58:09 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2014-02-09 23:58:09 +0530 |
commit | 72e11abeaf6500fa81ee2260fa446fcabcc2a944 (patch) | |
tree | fdd3fcb3056fd99e4b23f73dc6bae789426363c2 /guides | |
parent | ccd908f9ce4d1eef786a16c79d45af552cb9fe2b (diff) | |
download | rails-72e11abeaf6500fa81ee2260fa446fcabcc2a944.tar.gz rails-72e11abeaf6500fa81ee2260fa446fcabcc2a944.tar.bz2 rails-72e11abeaf6500fa81ee2260fa446fcabcc2a944.zip |
Simplify doc [ci skip]
The `as` option was already explained in a previous example
and doesn't need to be repeated. Explain only the `locals` option
which the example is meant for.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/layouts_and_rendering.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 0cb213521c..93e25d619e 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -1123,7 +1123,7 @@ You can also pass in arbitrary local variables to any partial you are rendering as: :item, locals: {title: "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`. +In this case, the partial will have access to a local variable `title` 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. |