-
Sorry, but with such attitude changing language would not help you. Changing language because you did not liked one forum response does not looks promising regardless of context.
-
Look that for others it does not matter if you spend few days or weeks. You have posted today and already received reply. We can’t travel in time and help you in all of those days before you have posted.
-
Rushing with a first project without understanding how things you use works is not the best idea. You should learn it first and ask questions if you don’t understand something. You can try to search for learning resources by yourself for example in Learning Resources category and as always you are welcome to ask for a help for finding a best resource for you.
-
@kokolegorille didn’t give you half of the information. It’s an answer full of keywords. He described two ways how to do it. Look that copy-paste whole
ecto
documentation isn’t also something you want, right? Thehexdocs
documentation have a search field. If you type for examplecast
even without pressing you would instantly get an option to navigate toEcto.Changeset.cast/4
function. The second way have even link tobuild_assoc
documentation. -
Giving just a hint instead of providing a complete working example is a good practice. When I’m sending an example code I’m also adding lots of comments and I’m linking a helpful resources, so others may learn more than what I wrote. Simply you would not learn much from copy-paste.
-
No matter if you are on
Elixir
,Ruby
on any other forum nobody is obligated to do a work for you. The primary thing is to educate by providing a generic answers, so many readers may found our answers helpful.
Besides above let’s focus on your problem … Correct me if I’m wrong, but most probably you started learning full phoenix
environment without touching ecto
first? Look that you can use phoenix
to work with other libraries as well as even without ecto
, so it simply does not makes sense to learn ecto
from phoenix
documentation, right?
So it should be obvious to look for ecto associations guide
to understand how ecto
and associations
works. I would start with those guides:
https://hexdocs.pm/ecto/getting-started.html
https://hexdocs.pm/ecto/constraints-and-upserts.html
https://elixirschool.com/en/lessons/ecto/associations
Have in mind that simply some things changed. For example in elixircasts video they are using old templates with <%= form for=… %>
call instead of heex
templates which are relatively new features, but it should not cause any problem especially if you test your code in iex
shell.
Also you may find this interesting:
In very different example I show how to setup ecto
-only environment in one Elixir
script file. If you did not know what it is then just give it a try simply by writing such example to file and calling it using following command elixir example.exs
in your shell.
Let us know if you don’t understand something…