diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-17 11:47:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-17 11:47:22 +0900 |
commit | 0f74fd1f816f941152a91578f62ea9cf702b9a98 (patch) | |
tree | 1500aec60250cc7ee656e31f5e1cc32f31359fcf | |
parent | 1198a3880bb2918bb771b55d94cfb333813744fa (diff) | |
parent | 8d5a2c4da12725beeb14ba70508762242c86696f (diff) | |
download | rails-0f74fd1f816f941152a91578f62ea9cf702b9a98.tar.gz rails-0f74fd1f816f941152a91578f62ea9cf702b9a98.tar.bz2 rails-0f74fd1f816f941152a91578f62ea9cf702b9a98.zip |
Merge pull request #34233 from lucasprag/update_guide
Update guide for the counter variable when rendering with the `as:` option
-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 00da65b784..ad08e5a5a9 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -1266,7 +1266,7 @@ You can also pass in arbitrary local variables to any partial you are rendering 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 title of the partial followed by `_counter`. For example, when rendering a collection `@products` the partial `_product.html.erb` can access the variable `product_counter` which indexes the number of times it has been rendered within the enclosing view. +TIP: Rails also makes a counter variable available within a partial called by the collection, named after the title of the partial followed by `_counter`. For example, when rendering a collection `@products` the partial `_product.html.erb` can access the variable `product_counter` which indexes the number of times it has been rendered within the enclosing view. Note that it also applies for when the partial name was changed by using the `as:` option. For example, the counter variable for the code above would be `item_counter`. You can also specify a second partial to be rendered between instances of the main partial by using the `:spacer_template` option: |