Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update put_assoc cheatsheet to use changesets #4437

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

patrickdavey
Copy link
Contributor

The existing docs use update_in on a struct and pass that to put_assoc which doesn't actually perform any updates because:

"structs are not change tracked in any fashion.
In other words, if you change a comment struct and give it to put_assoc/4, the updates in the struct won't be persisted. You must use changesets instead."

This fixes the doc to use changesets instead so the example can be followed.

The existing docs use update_in on a struct and pass that to put_assoc
which doesn't actually perform any updates because:

"structs are not change tracked in any fashion.
In other words, if you change a comment struct and give it to put_assoc/4,
the updates in the struct won't be persisted. You must use changesets instead."
@josevalim josevalim merged commit b64cdcf into elixir-ecto:master Jun 20, 2024
5 of 6 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants