Skip to content

Instantly share code, notes, and snippets.

@olivermt
Created December 5, 2018 11:22
Show Gist options
  • Save olivermt/170926237bf7eccffae80e30ba049723 to your computer and use it in GitHub Desktop.
Save olivermt/170926237bf7eccffae80e30ba049723 to your computer and use it in GitHub Desktop.
def join("room:" <> room_id, _params, socket) do
#this prints
IO.inspect(room_id)
case RoomCtx.find(room_id) do
nil ->
#does not print
IO.inspect("not found")
Logger.debug("[channel:room] attempted to join nonexistent room #{room_id}")
{:error, :not_found}
room ->
#does not print
IO.inspect("found room")
room = Repo.preload(room, :subscriptions)
do_join(socket, room, is_subscribed?(room, socket))
end
|> post_join()
end
def find(id) when is_binary(id) do
#this prints just fine
IO.inspect("Getting id #{id}")
Repo.get(Room, id)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment