Crowdhailer
Using Repo.insert_or_update without a changeset
The Ecto documentation clearly states that I can pass a struct_or_changeset to the insert_or_update/2 function on Repo
When I do this I get an error that says “giving a struct to Repo.insert_or_update/2 or Repo.insert_or_update!/2 is not supported”. When I use just insert/2 I can directly pass a struct.
Is it no longer possible to use this function without a changeset?
I have tried my code with versions 2.1.1 and 2.1.4 of ecto.
First Post!
Eiji
Last Post!
Eiji
@Crowdhailer: casting and validating - especially when you receive data from user or if source data have edge cases
You can see it when scraping data from lots of sites. Generally you expect that thousands of info pages have all info that you require, but for example some data could be missing (just not entered by user/admin).
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
- #code-sync
- #javascript
- #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
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









