Quiz: Make Multiple Changes

Quiz yourself on making multiple changes.

1

What is wrong with the following code snippet?

artist = %Artist{name: "Ben Webster"}
Repo.transaction(fn ->
Repo.insert!(artist) 
Repo.insert(Log.changeset_for_insert(artist)) 
end)
A)

It’s not using the Ecto.Multi module.

B)

The transaction function won’t work with anonymous functions.

C)

The second insert should be insert!.

D)

The snippet has no errors.

Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.