Skip to content

Commit 5cf188f

Browse files
committed
[ci skip] Clarify the doc for creating links:
- We mention how `*_path` works with various examples and suddenly use a code snippet that don't use the `*_path`. Modified the doc to use `product_path(product.id)`, to make it explicit. While it's longer, it's clearer, especially since we are in the "getting started guide" I don't think mentioning how `link_to(product)` works is a good idea in this guide, the `link_to` accepts a crazy amount of different values with many heuristics to determine the url to generate. This is documented in the action view guide and in the API. Let's keep it simple in the Getting Started guide. Fix rails#54162
1 parent fd4e570 commit 5cf188f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/source/getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ Let's refactor this to use these helpers:
11001100
<div id="products">
11011101
<% @products.each do |product| %>
11021102
<div>
1103-
<%= link_to product.name, product %>
1103+
<%= link_to product.name, product_path(product.id) %>
11041104
</div>
11051105
<% end %>
11061106
</div>
@@ -1147,7 +1147,7 @@ We can update `app/views/products/index.html.erb` to link to the new action.
11471147
<div id="products">
11481148
<% @products.each do |product| %>
11491149
<div>
1150-
<%= link_to product.name, product %>
1150+
<%= link_to product.name, product_path(product.id) %>
11511151
</div>
11521152
<% end %>
11531153
</div>

0 commit comments

Comments
 (0)