Checking changeset for changes causes changed? undefined error

I want to check if my changeset has changes in a true/false way. changset.changes returns %{} when empty, which is truthy, but I need that to be falsy here.

like: if changeset.has_change do...

I thought changed? would be the way but it doesn’t work for me.

How do I check the version of ecto? I’ve can’t find that info anywhere.

# user is a struct
iex(66)> changeset = Ecto.Changeset.change(user, %{id: 10})
#Ecto.Changeset<
  action: nil,
  changes: %{id: 10},
  errors: [],
  data: #User<>,
  valid?: true
iex > Ecto.Changeset.changed?(changeset, :id)

function Ecto.Changeset.changed/2 is undefined or private

Try another way using phoenix changeset

iex(78)> x = change_user(user, %{last_name: "smith"})
#Ecto.Changeset<
  action: nil,
  changes: %{last_name: "smith"},
  errors: [],
  data: #User<>,
  valid?: true
>
iex(79)> Ecto.Changeset.changed?(x, :last_name)                        
** (UndefinedFunctionError) function Ecto.Changeset.changed?/2 is undefined or private.

Is there another way I can do this? I guess checking for an empty map?

What version of Ecto are you using? Changeset.changed?/2 is very new (arrived in 3.10.0):

What version of Ecto are you using?

Yeah, how can I check this?

This must be the issue: An older version.

I just do this for now to solve my problem
if changeset.valid? && changeset.changes !== %{}

mix deps and then look to see what version of ecto is output.

mix deps and then look to see what version of ecto is output.

Thanks! I was not able to figure this one out.

Looks like I have ecto 3.9.4 which does not include changed?. So much for the hours spent trying to get it to work haha.