chris-menz
Help with Ecto.Multi
Hello,
I am attempting to use Ecto.multi for the first time to create related records. I have two tables, spot_conditions and spots. Spots belongs to spot_conditions. So i am trying to use ecto.multi to create both as following.
No spot is created, that is the output when trying to call the function. Not sure how to debug from here, any help would be greatly appreciated!
Marked As Solved
joey_the_snake
It looks like you are building the multi but not executing it. You just need to pass the finished multi into Repo.transaction in order to have it executed. Calling the multi functions themselves will just build up the commands you want to run but not actually execute them.
Also Liked
benwilson512
Hey @chris-menz I’m glad the issue was solved! As a minor note, please copy and paste text in the future instead of using screenshots. It’s a lot more accessible to different screen sizes, and also makes it easier for people to suggest small edits by copying, pasting, and editing the code.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance












