问题
Phoenix has a generator:
mix phx.gen.html Accounts User users name:string age:integer
I don't want to use a context for my models, neihter do I want to provide its name. How to disable it?
回答1:
I believe you want to use the --no-context
flag.
Generating without a schema or context file
回答2:
You can still use the old generators as they were in 1.2 and earlier
mix phoenix.gen.html User users name:string age:integer
Note: use phoenix.gen.html
instead of phx.gen.html
. More at the Phoenix 1.3 documentation.
The 1.3 generators were named differently so that they could be used side by side with the old.
来源:https://stackoverflow.com/questions/49227347/how-to-disable-context-in-elixir-phoenix-generators-and-models-completely