Skip to content

Commit

Permalink
Merge pull request #44684 from jenweber/patch-1
Browse files Browse the repository at this point in the history
[DOC] Introduce concerns example in Getting Started [ci-skip]

(cherry picked from commit da91d1c)
  • Loading branch information
jonathanhefner committed Mar 17, 2022
1 parent 365a85c commit 4e70972
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion guides/source/getting_started.md
Expand Up @@ -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`:

Expand Down

0 comments on commit 4e70972

Please sign in to comment.