Rails5 fix connection execute return integer instead of string

This commit is contained in:
Jasper Maes 2018-06-15 19:04:02 +02:00
parent 6d4a0325f1
commit cff72930a4
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Rails5 fix connection execute return integer instead of string
merge_request: 19901
author: Jasper Maes
type: fixed

View file

@ -17,7 +17,7 @@ module Gitlab
def check
catch_timeout 10.seconds do
if Gitlab::Database.postgresql?
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.[]('ping')
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.[]('ping')&.to_s
else
ActiveRecord::Base.connection.execute('SELECT 1 as ping')&.first&.first&.to_s
end