Consider the following schema:
defmodule EctoBug.Post do
use Ecto.Schema
import Ecto.Changeset
schema "posts" do
field :title, :string, default: "test"
timestamps()
end
def changeset(post, attrs) do
post
|> cast(attrs, [:title])
|> validate_required([:title])
end
end
If I do
changeset = EctoBug.Post.changeset(%EctoBug.Post{}, %{title: "test"})
title
field is not present in changes
:
#Ecto.Changeset<action: nil, changes: %{}, errors: [], data: #EctoBug.Post<>, valid?: true>
I couldn't find anything on this behavior.
Is it a bug?