Skip to content

Instantly share code, notes, and snippets.

@sobolevn
Last active May 7, 2017 09:36
Show Gist options
  • Save sobolevn/4f6d98afd2b10754ffb2b83609c5ae0f to your computer and use it in GitHub Desktop.
Save sobolevn/4f6d98afd2b10754ffb2b83609c5ae0f to your computer and use it in GitHub Desktop.
defmodule MediumPhxExample.Web.AlbumController do
use MediumPhxExample.Web, :controller
alias MediumPhxExample.Audio
alias MediumPhxExample.Audio.Album
action_fallback MediumPhxExample.Web.FallbackController
# ...
def update(conn, %{"id" => id, "album" => album_params}) do
album = Audio.get_album!(id)
with {:ok, %Album{} = album} <- Audio.update_album(album, album_params) do
render(conn, "show.json", album: album)
end
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment