Skip to content

Commit f6b987d

Browse files
Replace repeated list literals in Getting Started guide w/ a constant (rails#49007)
* Replace list literals w/ Visible::VALID_STATUSES In Getting Started guide, in the article and comment status dropdowns, use Visible::VALID_STATUSES instead of repeating the list of valid statuses. This makes the code DRYer and more expressive. This PR also adds a comment to that effect. * Remove text changes, leave just code Co-authored-by: Rafael Mendonça França <[email protected]>
1 parent fb48025 commit f6b987d

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
@@ -1922,7 +1922,7 @@ To finish up, we will add a select box to the forms, and let the user select the
19221922
```html+erb
19231923
<div>
19241924
<%= form.label :status %><br>
1925-
<%= form.select :status, ['public', 'private', 'archived'], selected: article.status || 'public' %>
1925+
<%= form.select :status, Visible::VALID_STATUSES, selected: article.status || 'public' %>
19261926
</div>
19271927
```
19281928

@@ -1931,7 +1931,7 @@ and in `app/views/comments/_form.html.erb`:
19311931
```html+erb
19321932
<p>
19331933
<%= form.label :status %><br>
1934-
<%= form.select :status, ['public', 'private', 'archived'], selected: 'public' %>
1934+
<%= form.select :status, Visible::VALID_STATUSES, selected: 'public' %>
19351935
</p>
19361936
```
19371937

0 commit comments

Comments
 (0)