【发布时间】:2018-05-10 01:03:32
【问题描述】:
尝试生成:
$ mix phx.gen.html MyModel my_models a b c d:integer
还有错误:
** (Mix) Expected the schema, "my_models", to be a valid module name
mix phx.gen.html, phx.gen.json and phx.gen.context expect a
context module name, followed by singular and plural names of
the generated resource, ending with any number of attributes.
For example:
mix phx.gen.html Accounts User users name:string
mix phx.gen.json Accounts User users name:string
mix phx.gen.context Accounts User users name:string
The context serves as the API boundary for the given resource.
Multiple resources may belong to a context and a resource may be
split over distinct contexts (such as Accounts.User and Payments.User).
这也不起作用:
$ mix phx.gen.html MyModel my_models a b c d:integer --no-context
$ mix phx.gen.html MyModel my_models a b c d:integer --no-context --no-schema
即使在此之后,错误仍然存在:
config :my_app, :generators,
context: false
这是怎么回事?
【问题讨论】:
-
这里是一个链接,它解释了文档的变化以及为什么现在上下文是一个东西:hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Html.html