Skip to content

Commit

Permalink
add note on calling methods more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Sep 14, 2023
1 parent b74783a commit d9069be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ The gem makes no assumption on a response's content type or what the migration
will do. You could, for example, migrate the response body, or mutate the
headers, or even change the response's status code.

The `response` method can be used multiple times per-migration.

### Request migrations

Request migrations define a change on a request. For example, modifying a request's
Expand Down Expand Up @@ -249,6 +251,8 @@ headers. It's up to you, all it does is provide the request.

Request migrations should [avoid using the `migrate` method](#avoid-migrate-for-request-migrations).

The `request` method can be used multiple times.

### Data migrations

In our first scenario, where we combined our user's name attributes, we defined
Expand Down Expand Up @@ -322,6 +326,10 @@ be applied.

In addition to data migrations, this allows for easier [testing](#testing).

The `migrate` method can be used multiple times per-migration to e.g.
match and migrate on different shapes of data. For a JSON:API app,
for example, you could migrate on `data: [*]` and `includes: [*]`.

### Routing constraints

When you want to encourage API clients to upgrade, you can utilize a routing `version_constraint`
Expand Down

0 comments on commit d9069be

Please sign in to comment.