Skip to content

Commit 596a74f

Browse files
excid3elhalvers
andcommitted
Explain local variables for partials
Co-authored-by: Eric Halverson <[email protected]>
1 parent 525ef39 commit 596a74f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

guides/source/getting_started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,10 @@ can define when we render the partial. We'll replace `@product` with `product`.
14231423
<% end %>
14241424
```
14251425

1426+
TIP: Using local variables allows partials to be reused multiple times on the
1427+
same page with a different value each time. This comes in handy rendering lists
1428+
of items like an index page.
1429+
14261430
To use this partial in our `app/views/products/new.html.erb` view, we can
14271431
replace the form with a render call:
14281432

0 commit comments

Comments
 (0)