https://elixircasts.io/adding-comments-with-ecto-associations
- Erlang 24.0
- Elixir 1.12.3
- NodeJS 14
- Pheonix 1.5.12
mix phx.gen.schema Comment comments body:text post_id:references:posts
to create a schema- All
controllers
in Phoenix are insingular
while that in rails are usually in plurals. - Have to define your own
Context
, here isBlogs
for data manipulations - Rely on module
Blogs
to do the handlers
mix pheonix.gen.model
is now asmix phx.gen.schema
- Since controllers and views are in
teacher_web
, they are under the module ofTeacherWeb
, notTeacher
- Similarly, we load
use TeacherWeb :controller
, insteaduse Teacher.Web :controller
- In the past, the context has defined as
Repo
, now it has to be configurable.