Virtual models in ecto

Is there a way we can define a virtual model in ecto. Which don’t havemigration file and don't persist in the data base. I didn’t find any documentation related to that in Ecto docs. I need this to test some functions in the iex. To test with models separate from the rest of the app.

I foundembedded schema which contain fields that don’t persist in the database but nothing related to the models.

Any help will be much appreciated.

You can use embedded_schema as a general purpose struct with Changeset functions to cast and validate.

Can you explain some more what else you need?

1 Like

i needed something what you described and a user answered on stack overflow.
https://stackoverflow.com/questions/50481333/virtual-models-in-ecto

Thanks for your input.