Last active
September 9, 2016 20:28
-
-
Save bryansray/1197a7fdcb3d8c0127e1686e18d09841 to your computer and use it in GitHub Desktop.
Refactoring Episode Controller
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 new(conn, %{"podcast_slug" => slug}, current_user) do | |
with podcast <- find_podcast_for_user(slug, current_user.id), | |
changeset <- build_episode(podcast) do | |
render(conn, :new, changeset: changeset, podcast: podcast) | |
else | |
_ -> redirect(conn, to: page_path(conn, :index)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment