From fff67e86a0e1d8d90e52504e2b54a0f458bfbbae Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Mon, 11 Jul 2016 12:56:40 -0300 Subject: [PATCH] Fix using_connection --- src/db/database.cr | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/db/database.cr b/src/db/database.cr index 65305bd..635c694 100644 --- a/src/db/database.cr +++ b/src/db/database.cr @@ -63,9 +63,11 @@ module DB # when the block ends def using_connection connection = get_from_pool - yield connection - ensure - return_to_pool connection + begin + yield connection + ensure + return_to_pool connection + end end include QueryMethods