Created
October 16, 2015 18:29
-
-
Save stueccles/92e60d6137e838107219 to your computer and use it in GitHub Desktop.
Checking for a current order
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
defp check_for_order(conn, _params) do | |
case get_current_order do | |
nil -> | |
conn |> redirect(to: "/") |> halt | |
order -> | |
assign(conn, :order, order) | |
end | |
end |
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 check_for_order | |
redirect_to root_path unless current_order.present? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment