But insert_all not seems to be working. If you look at the ecto.multi_all result . In the map the action is set to nil. Which i think should be insert like this
My bad . I thought Ecto.insert_all receives the changesets .But it actually receives the maps. like Repo.insert_all().
On side note is there any function of ecto that supports this multiple chagesets list of maps?
Because i want to validate the params and then insert into the database .
Two possible approaches for dealing with your list of changesets:
transform it into a series of Multi.insert calls that are then all executed at the end. Note that this will execute one SQL query per changeset, different from the behavior of insert_all.
transform the changesets into structs using Ecto.Changeset.apply_changes and then pass the structs to insert_all.
In both cases, you’ll want to handle changesets with valid?: false carefully; apply_changes, for instance, doesn’t check validity.