Referencing Model Structs

I know models have reached their sell by date, but…

I have something like this,

model.changeset(%User{}, row)

which works, but I want to reference the struct which is defined by the schema in the model - making this call generic, very sloppily:

model.changeset(%model{}, row)

which of course, does not work. Am sure there’s something obvious that I am missing - help appreciated : )

1 Like

Is this what you mean?

changeset(struct(model), row)

https://hexdocs.pm/elixir/Kernel.html#struct/1

2 Likes

Oh, sweet, I believe it is : )

1 Like