Skip to content

Instantly share code, notes, and snippets.

@stueccles
Created October 16, 2015 18:29
Show Gist options
  • Save stueccles/92e60d6137e838107219 to your computer and use it in GitHub Desktop.
Save stueccles/92e60d6137e838107219 to your computer and use it in GitHub Desktop.
Checking for a current order
defp check_for_order(conn, _params) do
case get_current_order do
nil ->
conn |> redirect(to: "/") |> halt
order ->
assign(conn, :order, order)
end
end
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