Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Created October 4, 2016 20:08
Show Gist options
  • Save lorenzo/0ac881a12898f993c99b9d63c9a4628b to your computer and use it in GitHub Desktop.
Save lorenzo/0ac881a12898f993c99b9d63c9a4628b to your computer and use it in GitHub Desktop.
def is_mate?(conn) do
current_user(conn)
|> Maybe.and_then(fn (user) -> Tripmate.Repo.get_by(Tripmate.Mate, user_id: user.id) end)
|> Maybe.map(fn _ -> true end)
|> Maybe.with_default(false)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment