I have a chat app where I want to store messages that are sent by a user in the database . I am using ecto for the project. In the code below you can see that I am providing chat_id that is a required field but its still returning that its blank.
Any help would be appreciated.
Repo.insert( PersonalMessage.changeset(%PersonalMessage{}, %{user_id: "dd8c3258-6749-4fc7-8470-eeb6cffa7137", chat_id: "ee4acecb-9e2d-4429-b9d2-4b07eb671eb2", text: "fjkdf"}))
{:error,
#Ecto.Changeset<
action: :insert,
changes: %{text: "fjkdf", user_id: "dd8c3258-6749-4fc7-8470-eeb6cffa7137"},
errors: [chat_id: {"can't be blank", [validation: :required]}],
data: #Chats.PersonalMessages.PersonalMessage<>,
valid?: false
>}