Today I Learned

hashrocket A Hashrocket project

Convert Changeset to Schema With Ecto

You can convert an Ecto.Changeset back to a schema by using Ecto.Changeset.apply_changes/1

movie_changeset = change(%Movie{title: "Citizen Kane"}, %{director: "Orson Welles"})
#=> This returns an ecto changeset with the new director change

apply_changes(movie_changeset) 
#=> %Movie{title: "Citizen Kane", director: "Orson Welles"}
See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.