How to disable context in Elixir/Phoenix generators and models completely?

随声附和 提交于 2019-12-11 14:06:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!