From 4e7097258c682a736f51036022d32ba47a21c05d Mon Sep 17 00:00:00 2001 From: Jonathan Hefner Date: Wed, 16 Mar 2022 10:45:09 -0500 Subject: [PATCH] Merge pull request #44684 from jenweber/patch-1 [DOC] Introduce concerns example in Getting Started [ci-skip] (cherry picked from commit da91d1cd7575ff83791ef3494dcdf3033ffd2b97) --- guides/source/getting_started.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 8046ab51b1d65..58913a03a8aba 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1703,7 +1703,9 @@ app/controllers/concerns app/models/concerns ``` -A given blog article might have various statuses - for instance, it might be visible to everyone (i.e. `public`), or only visible to the author (i.e. `private`). It may also be hidden to all but still retrievable (i.e. `archived`). Comments may similarly be hidden or visible. This could be represented using a `status` column in each model. +In the example below, we will implement a new feature for our blog that would benefit from using a concern. Then, we will create a concern, and refactor the code to use it, making the code more DRY and maintainable. + +A blog article might have various statuses - for instance, it might be visible to everyone (i.e. `public`), or only visible to the author (i.e. `private`). It may also be hidden to all but still retrievable (i.e. `archived`). Comments may similarly be hidden or visible. This could be represented using a `status` column in each model. First, let's run the following migrations to add `status` to `Articles` and `Comments`: