Lonestar ElixirConf 2017- KEYNOTE: Phoenix 1.3 by Chris McCord

Confreaks · 39K views · 2017 · 51:44

Open on YouTube

Web developmentFunctional programmingSoftware architecture & designtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when explaining why Phoenix 1.3 introduced contexts and what they are for, often to people confused by mix phx.gen output.

Recommended by 4 people across 4 different months, 2017 to 2020.

What it is

Keynote from Lonestar ElixirConf 2017 in which Phoenix creator Chris McCord presents Phoenix 1.3. It covers the new contexts concept that replaced the older models layout, plus the new project structure and umbrella app guidance. Recorded by Confreaks.

What people said

Recommends neon · 2017-03 · Stack Overflow · on “What is context in elixir phoenix html generator”

The context module allows us to remove Repo calls from the controller to their own module, so that there can be separation between concerns. For more, try listening to this talk by Chris McCord: [this video] and check out the comments in Phoenix code: [LINK]

Recommends Sheharyar · 2018-11 · Stack Overflow · on “How to reference outside Contexts in test files?”

For starters, phoenix-framework [LINK] does not force you to use Contexts , they're just a way of better organizing your code. This makes them slightly more confusing for beginners, compared to the File-Type First (FTF) structure of rails [LINK] applications, but makes the code heirarchy much more easier to understand and manage in the long haul. You can choose to use contexts or just put all modules together. Either way, whatever public functions you define are acessible from anywhere else in the app ( as long as you use the correct module name to call them ). More resources on Contexts: Youtube: Chris McCord on Contexts [this video] Hexdocs: Phoenix Contexts [LINK] Blog Post: Organizing Large R

Recommends Daniel · 2020-01 · Stack Overflow · on “How to properly use mix phx.gen.html? Receiving an error: "(Mix) Expected the schema, "posts", to be a valid module name"”

Since elixir is a very young language, videos from 2017 are outdated, a lot of infrastructure changed since then. At this point in time elixir and phoenix are pretty stable and at least elixir won't receive any more breaking changes, however old videos won't help you much. Notion of contexts was introduced in phoenix to replace the models structure. The idea behind it is that you don't put all your schemas in a model folder, however you group a bunch of schemas in a Context, witch is a common domain, you can listen more about how this works from [this video] the original creator of phoenix. To make it more clear, definitions for gen now go like this: mix phx.gen.html [Context] [Schema name] [Tabl

Recommends sabiwara · 2020-10 · Stack Overflow · on “Can't generate model in phoenix”

This tutorial is pretty out of date, I recommend using a more recent resource. If you want to know more about why models have been replaced with contexts in 1.3, you can check this talk [this video] .

Cites PatNowak · 2017-05 · Stack Overflow · on “Rails engine like with Phoenix”

Umbrella Apps are fine, but as Chris presented [this video] - the real use case for them is to have another storage. If you do have a rails app and you want to use its features on Phoenix - go and check out reverse proxy [LINK] apps. If you want to do it in opposite direction - use rails app with Phoenix features - read this great article [LINK] about it.

Cites jamescheuk · 2017-08 · Stack Overflow · on “Phoenix generator phoenix.gen.json vs mix phx.gen.json”

The significant difference with phoenix.gen.json and phx.gen.json is the context module . It is a concept of "Bounded Context" from Domain-Driven Design. The context is an Elixir module that serves as an API boundary for the given resource. A context often holds many related resources. Therefore, if the context already exists, it will be augmented with functions for the given resource. Note a resource may also be split over distinct contexts (such as Accounts.User and Payments.User). ( [LINK] ) In your case, you generated an API context module in lib/my_app/api/api.ex . You may want to rename to API context module to something like Content . == Compilation error in file lib/my_app_web/views/