Skip to content

Instantly share code, notes, and snippets.

@rbnpercy
Created July 7, 2018 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbnpercy/d5b75b67b9ff3634e15648393dbe7747 to your computer and use it in GitHub Desktop.
Save rbnpercy/d5b75b67b9ff3634e15648393dbe7747 to your computer and use it in GitHub Desktop.
def store(conn, file, album) do
case Images.create_photo(%{album_id: album, image: file}) do
{:ok, photo} ->
conn
|> put_flash(:info, "Photos created successfully.")
|> redirect(to: album_path(conn, :show, album))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment