Skip to content

Commit

Permalink
Clarify user message in phx.gen.json (#5787)
Browse files Browse the repository at this point in the history
  • Loading branch information
ponychicken committed May 4, 2024
1 parent fda159d commit 12582af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion guides/mix_tasks.md
Expand Up @@ -154,7 +154,7 @@ $ mix phx.gen.json Blog Post posts title:string content:string
When `mix phx.gen.json` is done creating files, it helpfully tells us that we need to add a line to our router file as well as run our Ecto migrations.

```console
Add the resource to your :api scope in lib/hello_web/router.ex:
Add the resource to the "/api" scope in lib/hello_web/router.ex:

resources "/posts", PostController, except: [:new, :edit]

Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/phx.gen.json.ex
Expand Up @@ -171,7 +171,7 @@ defmodule Mix.Tasks.Phx.Gen.Json do
else
Mix.shell().info("""
Add the resource to your :api scope in #{Mix.Phoenix.web_path(ctx_app)}/router.ex:
Add the resource to the "#{Application.get_env(ctx_app, :generators)[:api_prefix] || "/api"}" scope in #{Mix.Phoenix.web_path(ctx_app)}/router.ex:
resources "/#{schema.plural}", #{inspect(schema.alias)}Controller, except: [:new, :edit]
""")
Expand Down
2 changes: 1 addition & 1 deletion test/mix/tasks/phx.gen.json_test.exs
Expand Up @@ -113,7 +113,7 @@ defmodule Mix.Tasks.Phx.Gen.JsonTest do
[
"""
Add the resource to your :api scope in lib/phoenix_web/router.ex:
Add the resource to the "/api" scope in lib/phoenix_web/router.ex:
resources "/posts", PostController, except: [:new, :edit]
"""
Expand Down

0 comments on commit 12582af

Please sign in to comment.