What is "context" in phoenix 1.3-dev html generator?

I wanted to have a look at phoenix 1.3-dev. I clone phoenix from repository and followed the phoenix/installer/README.md to build archive.

phoenix/installer/README.md (for reference)

$ cd installer
$ MIX_ENV=prod mix archive.build
$ mix archive.install

I created a new phoenix app by mix phx.new blog but when i tried to create a simple html scaffold by mix phx.gen.html Post posts title body:text then i get following error message.

Error message

** (Mix) Expected the schema argument, “:“Elixir.Company.companies””, to be a valid module name

mix phx.gen.html and mix phx.gen.json expect a context module name,
followed by singular and plural names of the generated resource, ending
with any number of attributes:

mix phx.gen.html Accounts User users name:string
mix phx.gen.json Accounts User users name:string

The Accounts 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 Blog.User).

==== error msg ends ====

My question is why we should add a context module? how and where it helps?
if you know something about this, please describe a usecase so i can understand.

2 Likes

Chris McCord keynote at Elixir Conf 2016 goes over the rationale for the changes coming in 1.3: https://www.youtube.com/watch?v=qPiZTxUAaVM

We will probably see them in the text form soon.

3 Likes

unfortunately, unless you have military communication/air control hearing training, you can’t make hardly anything from the talk :frowning:

5 Likes

Oh, I forgot about that. Hopefully the video for lonestar will be out soon: https://confreaks.tv/conferences/lonestar-elixir

5 Likes