Responsibilities of an Ecto changeset function

The changeset is a data structure, like a map or a list. It doesn’t really have any responsibilities per se. Sometimes a map is the best data structure to solve a problem, sometimes it isn’t. Sometimes the changeset is the best one, sometimes it isn’t. A changeset is required really on Repo.update, since you need to track changes to perform updates.

For simple validation, maybe it is more straight-forward to bypass the changeset altogether and compare a token directly, but using it or not should not matter as long as the token is validated and displayed to the user.

1 Like