Created
July 7, 2018 00:53
-
-
Save rbnpercy/93701213011c3aa7d1ff526a1955c4e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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