Skip to content

Instantly share code, notes, and snippets.

@rbnpercy
Created July 7, 2018 00:53
Show Gist options
  • Save rbnpercy/93701213011c3aa7d1ff526a1955c4e0 to your computer and use it in GitHub Desktop.
Save rbnpercy/93701213011c3aa7d1ff526a1955c4e0 to your computer and use it in GitHub Desktop.
def create(conn, %{"photo" => %{"image" => image_params} = photo_params}) do
upload(image_params)
case Images.create_photo(photo_params) do
{:ok, photo} ->
conn
|> put_flash(:info, "Photo created successfully.")
|> redirect(to: photo_path(conn, :show, photo))
{: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