mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #30884 from robwold/patch-1
Update layouts_and_rendering.md [ci skip]
This commit is contained in:
commit
d4eef60531
1 changed files with 1 additions and 1 deletions
|
@ -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 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.
|
||||
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.
|
||||
|
||||
You can also specify a second partial to be rendered between instances of the main partial by using the `:spacer_template` option:
|
||||
|
||||
|
|
Loading…
Reference in a new issue